Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion apps/provisioning_api/lib/Controller/GroupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ public function getGroup(string $groupId): DataResponse {
}

/**
* @NoSubAdminRequired
*
* Get a list of users in the specified group
*
* @param string $groupId ID of the group
Expand All @@ -154,14 +156,15 @@ public function getGroupUsers(string $groupId): DataResponse {
$group = $this->groupManager->get($groupId);
if ($group !== null) {
$isSubadminOfGroup = $this->groupManager->getSubAdmin()->isSubAdminOfGroup($user, $group);
$isMember = $this->groupManager->isInGroup($user->getUID(), $group->getGID());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this kind of checks should be done only when $isAdmin is false, to avoid useless queries.

} else {
throw new OCSNotFoundException('The requested group could not be found');
}

// Check subadmin has access to this group
$isAdmin = $this->groupManager->isAdmin($user->getUID());
$isDelegatedAdmin = $this->groupManager->isDelegatedAdmin($user->getUID());
if ($isAdmin || $isDelegatedAdmin || $isSubadminOfGroup) {
if ($isAdmin || $isDelegatedAdmin || $isSubadminOfGroup || $isMember) {
$users = $this->groupManager->get($groupId)->getUsers();
$users = array_map(function ($user) {
/** @var IUser $user */
Expand Down
Loading