mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #10751 from xini/patch-7
make Group use tri-state can* extension hooks, fixes #9580
This commit is contained in:
commit
37937b7123
@ -583,12 +583,10 @@ class Group extends DataObject
|
||||
$member = Security::getCurrentUser();
|
||||
}
|
||||
|
||||
// extended access checks
|
||||
$results = $this->extend('canEdit', $member);
|
||||
if ($results && is_array($results)) {
|
||||
if (!min($results)) {
|
||||
return false;
|
||||
}
|
||||
// check for extensions, we do this first as they can overrule everything
|
||||
$extended = $this->extendedCan(__FUNCTION__, $member);
|
||||
if ($extended !== null) {
|
||||
return $extended;
|
||||
}
|
||||
|
||||
if (// either we have an ADMIN
|
||||
@ -619,12 +617,10 @@ class Group extends DataObject
|
||||
$member = Security::getCurrentUser();
|
||||
}
|
||||
|
||||
// extended access checks
|
||||
$results = $this->extend('canView', $member);
|
||||
if ($results && is_array($results)) {
|
||||
if (!min($results)) {
|
||||
return false;
|
||||
}
|
||||
// check for extensions, we do this first as they can overrule everything
|
||||
$extended = $this->extendedCan(__FUNCTION__, $member);
|
||||
if ($extended !== null) {
|
||||
return $extended;
|
||||
}
|
||||
|
||||
// user needs access to CMS_ACCESS_SecurityAdmin
|
||||
@ -646,12 +642,10 @@ class Group extends DataObject
|
||||
$member = Security::getCurrentUser();
|
||||
}
|
||||
|
||||
// extended access checks
|
||||
$results = $this->extend('canDelete', $member);
|
||||
if ($results && is_array($results)) {
|
||||
if (!min($results)) {
|
||||
return false;
|
||||
}
|
||||
// check for extensions, we do this first as they can overrule everything
|
||||
$extended = $this->extendedCan(__FUNCTION__, $member);
|
||||
if ($extended !== null) {
|
||||
return $extended;
|
||||
}
|
||||
|
||||
return $this->canEdit($member);
|
||||
|
Loading…
Reference in New Issue
Block a user