fix: [OrgGroups:checkIfGroupAdmin] Consider site_admins as group admin
parent
44527bbcb8
commit
b2df8192f7
|
@ -175,8 +175,8 @@ class ACLComponent extends Component
|
||||||
'listOrgs' => ['*'],
|
'listOrgs' => ['*'],
|
||||||
'assignAdmin' => ['perm_admin'],
|
'assignAdmin' => ['perm_admin'],
|
||||||
'removeAdmin' => ['perm_admin'],
|
'removeAdmin' => ['perm_admin'],
|
||||||
'attachOrg' => ['perm_group_admin'],
|
'attachOrg' => ['perm_admin', 'perm_group_admin'],
|
||||||
'detachOrg' => ['perm_group_admin']
|
'detachOrg' => ['perm_admin', 'perm_group_admin']
|
||||||
],
|
],
|
||||||
'Organisations' => [
|
'Organisations' => [
|
||||||
'add' => ['perm_admin'],
|
'add' => ['perm_admin'],
|
||||||
|
|
|
@ -37,6 +37,9 @@ class OrgGroupsTable extends AppTable
|
||||||
|
|
||||||
public function checkIfGroupAdmin(int $groupId, User $user): bool
|
public function checkIfGroupAdmin(int $groupId, User $user): bool
|
||||||
{
|
{
|
||||||
|
if (!empty($user['role']['perm_admin'])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
$orgGroup = $this->get($groupId, ['contain' => 'Users']);
|
$orgGroup = $this->get($groupId, ['contain' => 'Users']);
|
||||||
if (empty($orgGroup)) {
|
if (empty($orgGroup)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue