Role Admin can be removed from user Admin #908

Closed
opened 2026-02-04 22:52:24 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @Bolthier on GitHub (Nov 14, 2018).

Describe the bug
While the role admin can not be restricted it is possible to remove the user Admin from this role.

Steps To Reproduce
Steps to reproduce the behavior:

  1. Go to Settings > Users > Admin
  2. Remove role Admin > add role Public > Save
  3. "You have no permission to view this site."

Expected behavior
Error Message "You can't remove the role Admin for this user." or "At least one user must inherit the role Admin." or a gray box before role Admin.
check box 2

Similar to the way the permissions of the role Admin cannot be altered it shouldn't be allowed to remove the role Admin from the user admin. It should only be possible to add other roles.

For better understanding the permanent permissions set for the role Admin should be grayed out too.
check box

Screenshots
permission

Your Configuration (please complete the following information):

  • Exact BookStack Version (Found in settings): BookStack v0.24.2
  • PHP Version: 7.2
  • Hosting Method (Nginx/Apache/Docker): Apache2

Related but not sames issues:
https://github.com/BookStackApp/BookStack/issues/834
https://github.com/BookStackApp/BookStack/issues/977

Originally created by @Bolthier on GitHub (Nov 14, 2018). **Describe the bug** While the role admin can not be restricted it is possible to remove the user Admin from this role. **Steps To Reproduce** Steps to reproduce the behavior: 1. Go to Settings > Users > Admin 2. Remove role Admin > add role Public > Save 3. "You have no permission to view this site." **Expected behavior** Error Message "You can't remove the role Admin for this user." or "At least one user must inherit the role Admin." or a gray box before role Admin. ![check box 2](https://user-images.githubusercontent.com/42382626/48509994-dac36180-e852-11e8-917a-95e1d6678b25.png) Similar to the way the permissions of the role Admin cannot be altered it shouldn't be allowed to remove the role Admin from the user admin. It should only be possible to add other roles. For better understanding the permanent permissions set for the role Admin should be grayed out too. ![check box](https://user-images.githubusercontent.com/42382626/48509904-a0f25b00-e852-11e8-8728-a7ae79547713.png) **Screenshots** ![permission](https://user-images.githubusercontent.com/42382626/48508928-20325f80-e850-11e8-820e-aca491017b27.PNG) **Your Configuration (please complete the following information):** - Exact BookStack Version (Found in settings): BookStack v0.24.2 - PHP Version: 7.2 - Hosting Method (Nginx/Apache/Docker): Apache2 Related but not sames issues: https://github.com/BookStackApp/BookStack/issues/834 https://github.com/BookStackApp/BookStack/issues/977
OVERLORD added the 🛠️ Enhancement🔒 Security🏭 Back-End labels 2026-02-04 22:52:24 +03:00
Author
Owner

@lommes commented on GitHub (Dec 5, 2018):

@ssddanbrown How are you planning to implement this?

It is of course usefull to remove the Admin role from users and there might even be valid use cases where it is intended to remove the role from the currently authenticated user (especially together with ldap group sync). There still is php artisan bookstack:create-admin to fix this

@lommes commented on GitHub (Dec 5, 2018): @ssddanbrown How are you planning to implement this? It is of course usefull to remove the Admin role from users and there might even be valid use cases where it is intended to remove the role from the currently authenticated user (especially together with ldap group sync). There still is `php artisan bookstack:create-admin` to fix this
Author
Owner

@ssddanbrown commented on GitHub (Dec 5, 2018):

@lommes I was thinking about just adding a check to see if the user is the only remaining admin user, then throw an error if so. So the current user can still remove the role from themselves if there's another admin in the system.

@ssddanbrown commented on GitHub (Dec 5, 2018): @lommes I was thinking about just adding a check to see if the user is the only remaining admin user, then throw an error if so. So the current user can still remove the role from themselves if there's another admin in the system.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#908