Skip to content
Merged
Show file tree
Hide file tree
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/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,10 @@
// If they're not an admin, check they are a subadmin of the group in question
$loggedInUser = $this->userSession->getUser();
$subAdminManager = $this->groupManager->getSubAdmin();
if (!$this->groupManager->isAdmin($loggedInUser->getUID()) && !$subAdminManager->isSubAdminOfGroup($loggedInUser, $group)) {
if (
!$this->groupManager->isAdmin($loggedInUser->getUID())
&& !($subAdminManager->isSubAdminOfGroup($loggedInUser, $group) && $subAdminManager->isUserAccessible($loggedInUser, $targetUser))
) {
throw new OCSException('', 104);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2788,6 +2788,11 @@ public function testAddToGroupSuccessAsSubadmin() {
->with($loggedInUser, $targetGroup)
->willReturn(true);

$subAdminManager->expects($this->once())
->method('isUserAccessible')
->with($loggedInUser, $targetUser)
->willReturn(true);

$this->groupManager->expects($this->once())
->method('getSubAdmin')
->willReturn($subAdminManager);
Expand Down
Loading