fix: [temp] ACL function built up

pull/163/head
iglocska 2023-09-12 14:17:11 +02:00
parent 4d58b94d58
commit 1d9b54348a
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 10 additions and 1 deletions

View File

@ -37,8 +37,17 @@ class OrgGroupsTable extends AppTable
public function checkIfGroupAdmin(int $groupId, mixed $user): bool public function checkIfGroupAdmin(int $groupId, mixed $user): bool
{ {
$orgGroup = $this->get($groupId, ['contain' => 'Users']);
if (empty($orgGroup)) {
return false;
}
foreach ($orgGroup['users'] as $u) {
if ($user['id'] == $u['id']) {
return true; return true;
} }
}
return false;
}
public function checkIfUserBelongsToGroupAdminsGroup(User $currentUser, User $userToCheck): bool public function checkIfUserBelongsToGroupAdminsGroup(User $currentUser, User $userToCheck): bool
{ {