mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
make Group use tri-state can* extension hooks, fixes #9580
This commit is contained in:
parent
2c874a1e94
commit
41c4b4ee02
@ -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
|
||||
@ -641,12 +637,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