Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fusiondirectory
fusiondirectory
Commits
fbe8a885
Commit
fbe8a885
authored
Apr 11, 2019
by
Côme Chilliet
Browse files
✨
feat(management) Give access to the entry in Action::hasPermission
issue
#5980
parent
9dd73d8b
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/management/actions/class_Action.inc
View file @
fbe8a885
...
@@ -176,7 +176,7 @@ class Action
...
@@ -176,7 +176,7 @@ class Action
return
;
return
;
}
}
if
(
!
$this
->
hasPermission
(
$this
->
parent
->
listing
->
getBase
()
))
{
if
(
!
$this
->
hasPermission
())
{
return
;
return
;
}
}
...
@@ -204,7 +204,7 @@ class Action
...
@@ -204,7 +204,7 @@ class Action
}
}
// Skip the entry completely if there's no permission to execute it
// Skip the entry completely if there's no permission to execute it
if
(
!
$this
->
hasPermission
(
$entry
->
dn
,
$entry
->
getTemplatedType
(),
$entry
->
isTemplate
()
))
{
if
(
!
$this
->
hasPermission
(
$entry
))
{
return
'<img src="images/empty.png" alt=" " class="optional"/>'
;
return
'<img src="images/empty.png" alt=" " class="optional"/>'
;
}
}
...
@@ -226,14 +226,18 @@ class Action
...
@@ -226,14 +226,18 @@ class Action
return
TRUE
;
return
TRUE
;
}
}
function
hasPermission
(
st
r
ing
$dn
,
string
$type
=
NULL
,
bool
$template
=
FALSE
):
bool
function
hasPermission
(
Li
sting
Entry
$entry
=
NULL
):
bool
{
{
global
$ui
;
global
$ui
;
if
(
$type
===
NULL
)
{
if
(
$entry
===
NULL
)
{
$types
=
$this
->
parent
->
objectTypes
;
$dn
=
$this
->
parent
->
listing
->
getBase
();
$types
=
$this
->
parent
->
objectTypes
;
$template
=
FALSE
;
}
else
{
}
else
{
$types
=
[
$type
];
$dn
=
$entry
->
dn
;
$types
=
[
$entry
->
getTemplatedType
()];
$template
=
$entry
->
isTemplate
();
}
}
/*
/*
* if category is missing it’s deducted from type (all types are tested for menu actions)
* if category is missing it’s deducted from type (all types are tested for menu actions)
...
...
plugins/admin/users/class_LockAction.inc
View file @
fbe8a885
...
@@ -49,7 +49,7 @@ class LockAction extends Action
...
@@ -49,7 +49,7 @@ class LockAction extends Action
return
;
return
;
}
}
if
(
!
$this
->
hasPermission
(
$this
->
parent
->
listing
->
getBase
()
))
{
if
(
!
$this
->
hasPermission
())
{
return
;
return
;
}
}
...
@@ -84,7 +84,7 @@ class LockAction extends Action
...
@@ -84,7 +84,7 @@ class LockAction extends Action
}
}
// Skip the entry completely if there's no permission to execute it
// Skip the entry completely if there's no permission to execute it
if
(
!
$this
->
hasPermission
(
$entry
->
dn
,
$entry
->
getTemplatedType
(),
$entry
->
isTemplate
()
))
{
if
(
!
$this
->
hasPermission
(
$entry
))
{
return
'<img src="images/empty.png" alt=" " class="center optional"/>'
;
return
'<img src="images/empty.png" alt=" " class="center optional"/>'
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment