diff --git a/lib/Service/LoginService.php b/lib/Service/LoginService.php index cbf1f4c..8ab072b 100644 --- a/lib/Service/LoginService.php +++ b/lib/Service/LoginService.php @@ -477,7 +477,7 @@ private function updateUserGroups(IUser $user, array $groupNames, array $profile // Remove user from groups not present $currentUserGroups = $this->groupManager->getUserGroups($user); foreach ($currentUserGroups as $currentUserGroup) { - if (($key = array_search($currentUserGroup->getDisplayName(), $groupNames, true)) !== false) { + if (($key = array_search($currentUserGroup->getGID(), $groupNames, true)) !== false) { // User is already in group - don't process further unset($groupNames[$key]); } else { @@ -485,7 +485,7 @@ private function updateUserGroups(IUser $user, array $groupNames, array $profile // Remove the user ONLY if we're using profile groups // or the group is the `admin` group and we manage admin role if ($this->attr->hasGroups($profile) - || ($this->attr->managesAdmin() && 'admin' === $currentUserGroup->getDisplayName())) { + || ($this->attr->managesAdmin() && 'admin' === $currentUserGroup->getGID())) { $currentUserGroup->removeUser($user); } }