Merge branch 'develop' of github.com:cerebrate-project/cerebrate into develop

refacto/CRUDComponent
Sami Mokaddem 2023-09-12 14:18:20 +02:00
commit d5d1f0b572
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 10 additions and 1 deletions

View File

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