| @@ 184-200 (lines=17) @@ | ||
| 181 | * @return DataResponse |
|
| 182 | * @throws OCSException |
|
| 183 | */ |
|
| 184 | public function getSubAdminsOfGroup(string $groupId): DataResponse { |
|
| 185 | // Check group exists |
|
| 186 | $targetGroup = $this->groupManager->get($groupId); |
|
| 187 | if($targetGroup === null) { |
|
| 188 | throw new OCSException('Group does not exist', 101); |
|
| 189 | } |
|
| 190 | ||
| 191 | /** @var IUser[] $subadmins */ |
|
| 192 | $subadmins = $this->groupManager->getSubAdmin()->getGroupsSubAdmins($targetGroup); |
|
| 193 | // New class returns IUser[] so convert back |
|
| 194 | $uids = []; |
|
| 195 | foreach ($subadmins as $user) { |
|
| 196 | $uids[] = $user->getUID(); |
|
| 197 | } |
|
| 198 | ||
| 199 | return new DataResponse($uids); |
|
| 200 | } |
|
| 201 | ||
| 202 | } |
|
| 203 | ||
| @@ 865-880 (lines=16) @@ | ||
| 862 | * @return array |
|
| 863 | * @throws OCSException |
|
| 864 | */ |
|
| 865 | protected function getUserSubAdminGroupsData(string $userId): array { |
|
| 866 | $user = $this->userManager->get($userId); |
|
| 867 | // Check if the user exists |
|
| 868 | if($user === null) { |
|
| 869 | throw new OCSException('User does not exist', 101); |
|
| 870 | } |
|
| 871 | ||
| 872 | // Get the subadmin groups |
|
| 873 | $subAdminGroups = $this->groupManager->getSubAdmin()->getSubAdminsGroups($user); |
|
| 874 | $groups = []; |
|
| 875 | foreach ($subAdminGroups as $key => $group) { |
|
| 876 | $groups[] = $group->getGID(); |
|
| 877 | } |
|
| 878 | ||
| 879 | return $groups; |
|
| 880 | } |
|
| 881 | ||
| 882 | /** |
|
| 883 | * Get the groups a user is a subadmin of |
|