Remove "RolePermission" model and table #3518

Closed
opened 2026-02-05 06:57:29 +03:00 by OVERLORD · 1 comment
Owner

Originally created by @ssddanbrown on GitHub (Feb 20, 2023).

The permissions available to roles are relatively fixed and not user controllable.
They are often used by name (string) within the codebase for checking permissions.

It would probably be better just to maintain these as code rather than via the database, so changes don't need migrations and so we can be programatic references to permissions within code.

These would probably work best as an Enum so waiting until we have PHP8.1 minimum support may be convenient since there's otherwise no specific rush for this.

Originally created by @ssddanbrown on GitHub (Feb 20, 2023). The permissions available to roles are relatively fixed and not user controllable. They are often used by name (string) within the codebase for checking permissions. It would probably be better just to maintain these as code rather than via the database, so changes don't need migrations and so we can be programatic references to permissions within code. These would probably work best as [an `Enum`](https://www.php.net/manual/en/language.types.enumerations.php) so waiting until we have PHP8.1 minimum support may be convenient since there's otherwise no specific rush for this.
OVERLORD added the 🔧 Maintenance🏭 Back-End labels 2026-02-05 06:57:29 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Sep 8, 2025):

Changed my mind on this.
It'll be tricky to use just an enum while allowing flexibility for custom role permissions (which I'm sure some instances add for customizations).
Could maybe have a custom class to manage the options, but I don't think that's much better than the existing table status quo really, at least to be worthwhile breaking things for those users.

Still adding an enum via #5793 for use in-app to reduce string usage. That also removes some of the unused columns.

@ssddanbrown commented on GitHub (Sep 8, 2025): Changed my mind on this. It'll be tricky to use just an enum while allowing flexibility for custom role permissions (which I'm sure some instances add for customizations). Could maybe have a custom class to manage the options, but I don't think that's much better than the existing table status quo really, at least to be worthwhile breaking things for those users. Still adding an enum via #5793 for use in-app to reduce string usage. That also removes some of the unused columns.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#3518