Repository navigation
Releases
v1.7.0
Added
- Backpack 7 support (
backpack/crud7.0.47 or later, optional):Siberfx\RbacPermission\Backpack\HasRbacAccess: add to a CRUD controller and callapplyRbacAccess()insetup(). Each Backpack operation maps to a catalog verb. Lists are narrowed withRbac::constrain(), and single records are checked against their scope.Siberfx\RbacPermission\Backpack\HasBackpackRbac: for the admin user model. Its roles live in the Backpack guard (backpack.base.guard).
Upgrading
No migration. Install backpack/crud 7.0.47 or later to use the Backpack integration.
v1.6.0
Added
- Filament 5 integration.
Siberfx\RbacPermission\Filament\RbacPluginadds a Roles resource to a panel. Filament is optional and required only when you use the plugin. - Roles resource: lists the roles of every guard and edits name, description and rank. Editing is limited to roles below the signed-in user's rank.
- Grants relation manager on each role: add and remove grants, each checked with
Rbac::canGrant(). UserRolesRelationManagerfor your user resource: shows a user's roles and expiry, and assigns or removes them under the rank rules.
Upgrading
No migration. Install Filament 5.8.3 or later to use the plugin.
v1.5.0
Added
- Admin screens: Blade pages for roles, role grants and user role assignments, served under
rbac.ui.prefix. Off by default (rbac.ui.enabled). - Each page checks a catalog permission:
admin.role.show,admin.role.edit,admin.user.show,admin.user.edit. Rbac::canGrant(). An actor can only put a permission on a role if they hold every matching permission at that scope or wider.- Views can be published with
php artisan vendor:publish --tag=rbac-views.
Upgrading
No migration. To use the screens, set rbac.ui.enabled to true.
v1.4.0
Added
- Multiple authentication guards. Roles carry a
guard, and a slug is unique per guard, somanagercan exist forwebandadminwith different grants. HasRbac::rbacGuard()says which guard a user model uses (defaults toauth.defaults.guard). Roles, ranks and grants are resolved within that guard.rbac.guardsconfig: roles and ranks for each additional guard.rbac:syncwrites every guard unless--guardis given.--guardoption onrbac:sync,rbac:matrixandrbac:grant.- Checks without an explicit user use the first logged-in user across the default and configured guards.
Changed
Rbac::role(),grant(),revoke(),sync()andmatrix()accept an optional guard. String role names inassign()andunassign()are resolved in the user's guard.
Upgrading
Publish and run the new migration add_guard_to_rbac_roles. Existing roles get the default guard. The unique index on slug is replaced by one on (guard, slug).
v1.3.0
Added
Siberfx\RbacPermission\Events\RbacChangedis dispatched after every change to roles, assignments and direct grants. Actions:role.granted,role.revoked,role.assigned,role.unassigned,permission.allowed,permission.denied,permission.withdrawn,roles.synced,grants.pruned.- Optional audit log. With
rbac.audit.enabled = true, each event is stored inrbac_audit_logs(actor, subject, permission, scope, effect, expiry, properties).
Upgrading
Publish and run the new migration create_rbac_audit_logs_table if you plan to enable the audit log. Nothing reads or writes the table while rbac.audit.enabled is false.
v1.2.0
Added
- Time-boxed grants.
assign(),assignRole(),allow(),deny(),allowPermission()anddenyPermission()accept an optional expiry. Expired role assignments and direct grants stop applying immediately. Rbac::pruneExpired()deletes expired rows.rbac:assign --expires=(for example"+7 days").HasRbac::hasRole()ignores expired assignments, androles()exposes theexpires_atpivot.
Changed
- Re-assigning a role or re-issuing a direct grant updates its expiry. Omitting the date makes it permanent again.
Upgrading
Publish and run the new migration add_expires_at_to_rbac_grants (adds expires_at to rbac_role_assignments and rbac_user_grants).
v1.1.0
Added
- Role hierarchy. Roles carry a
rank(set inrbac.ranks, applied byrbac:sync). An actor may only assign or remove a role strictly below their highest rank. Rbac::assign(),Rbac::unassign(),HasRbac::assignRole()andremoveRole()accept an optional actor (by:). Without one nothing is checked, as before.Rbac::rankOf()andRbac::canAssign().RoleAssignmentDeniedexception, raised when the hierarchy blocks a change.
Upgrading
Publish and run the new migration add_rank_to_rbac_roles (adds rank to rbac_roles, default 0).
v1.0.0 - first stable release
First stable release of siberfx/rbac-permission.
- Permission grammar
module.resource.verb@scopewith wildcards - Scope ladder
own<team<tenant<global - Role and direct grants, with denies that always win
Rbac::constrain()for list queries- Enforcement for models, Gate, Blade, HTTP, services and console
rbac:explain,rbac:matrix,rbac:syncand more
See CHANGELOG.md for the full list.