diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php index bd327ffe44..07a1514dd1 100644 --- a/apps/provisioning_api/lib/Controller/UsersController.php +++ b/apps/provisioning_api/lib/Controller/UsersController.php @@ -504,8 +504,8 @@ class UsersController extends AUserData { } else { // Check if admin / subadmin $subAdminManager = $this->groupManager->getSubAdmin(); - if ($subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser) - || $this->groupManager->isAdmin($currentLoggedInUser->getUID())) { + if ($this->groupManager->isAdmin($currentLoggedInUser->getUID()) + || $subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)) { // They have permissions over the user $permittedFields[] = 'display'; $permittedFields[] = AccountManager::PROPERTY_DISPLAYNAME; diff --git a/lib/private/SubAdmin.php b/lib/private/SubAdmin.php index d292e998ab..9a758ac442 100644 --- a/lib/private/SubAdmin.php +++ b/lib/private/SubAdmin.php @@ -255,6 +255,7 @@ class SubAdmin extends PublicEmitter implements ISubAdmin { if ($this->groupManager->isAdmin($user->getUID())) { return false; } + $accessibleGroups = $this->getSubAdminsGroups($subadmin); foreach ($accessibleGroups as $accessibleGroup) { if ($accessibleGroup->inGroup($user)) {