]> BookStack Code Mirror - bookstack/blobdiff - app/Auth/UserRepo.php
Fixed not being able to remove all user roles
[bookstack] / app / Auth / UserRepo.php
index 78bcb978ebc997f3346d0e8dfb8a319cbfe641a4..2c27f34a7e84d120f6aad811c4d4750804c08092 100644 (file)
@@ -234,6 +234,8 @@ class UserRepo
      */
     protected function setUserRoles(User $user, array $roles)
     {
+        $roles = array_filter(array_values($roles));
+
         if ($this->demotingLastAdmin($user, $roles)) {
             throw new UserUpdateException(trans('errors.role_cannot_remove_only_admin'), $user->getEditUrl());
         }