make Group use tri-state can* extension hooks, fixes #9580

This commit is contained in:
Florian Thoma 2023-04-06 08:14:55 +10:00
parent 2c874a1e94
commit 41c4b4ee02

View File

@ -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);