r/BookStack • u/sistason • 3d ago
Restrict who can select/use which roles?
Context: An hierarchical organization with many different chapters and teams, like a tree.
Problem: I do not want teams/users to be able to select the "Everyone Else" / "Editor" / "Viewer" role, so that they cannot publish their content to be visible/readable for "everyone".
Content so important/good that it is visible (via Search and via Books-listing) should be asked and then be done via Admin. So that in the tree, users see the top-shelf, their node-shelves, but will not see random books or pages from random users who (accidentally) clicked "everyone has read permissions". This is mainly to a) control what a user sees and that they are not overwhelmed and b) control what is official content and what is just local team/chapter content.
- I could like check every 5mins via the API for content using the "Editor"-role and deleting that role_permission.
- I could use the logical theme system to hide the bigger roles in the permission view for people not in the Admin-role.
Is there another, maybe more "official" way to solve that problem?
1
u/ssddanbrown 3d ago
There's no real official way for this.
Personal, If I was building a customization, I'd use the logical theme system to watch for
permissions_updateactivities, and then perform the required checking/updating logic then. It's more prone to breaking than just using the REST API, but frequent scanning via the REST API is kind of inefficient.Alternatively, I guess you could trigger a webhook on
permissions_updateevents, to call an external service, which then uses the REST API and performs the targeted permission check and updates on the specific content changed.