Skip to content

Releases

v1.7.0

Choose a tag to compare

@siberfx siberfx released this 15 Nov 02:37

Added

  • Backpack 7 support (backpack/crud 7.0.47 or later, optional):
    • Siberfx\RbacPermission\Backpack\HasRbacAccess: add to a CRUD controller and call applyRbacAccess() in setup(). Each Backpack operation maps to a catalog verb. Lists are narrowed with Rbac::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

Choose a tag to compare

@siberfx siberfx released this 15 Nov 02:34

Added

  • Filament 5 integration. Siberfx\RbacPermission\Filament\RbacPlugin adds 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().
  • UserRolesRelationManager for 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

Choose a tag to compare

@siberfx siberfx released this 15 Nov 02:22

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

Choose a tag to compare

@siberfx siberfx released this 15 Nov 02:18

Added

  • Multiple authentication guards. Roles carry a guard, and a slug is unique per guard, so manager can exist for web and admin with different grants.
  • HasRbac::rbacGuard() says which guard a user model uses (defaults to auth.defaults.guard). Roles, ranks and grants are resolved within that guard.
  • rbac.guards config: roles and ranks for each additional guard. rbac:sync writes every guard unless --guard is given.
  • --guard option on rbac:sync, rbac:matrix and rbac:grant.
  • Checks without an explicit user use the first logged-in user across the default and configured guards.

Changed

  • Rbac::role(), grant(), revoke(), sync() and matrix() accept an optional guard. String role names in assign() and unassign() 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

Choose a tag to compare

@siberfx siberfx released this 15 Nov 01:53

Added

  • Siberfx\RbacPermission\Events\RbacChanged is 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 in rbac_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

Choose a tag to compare

@siberfx siberfx released this 15 Nov 01:51

Added

  • Time-boxed grants. assign(), assignRole(), allow(), deny(), allowPermission() and denyPermission() 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, and roles() exposes the expires_at pivot.

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

Choose a tag to compare

@siberfx siberfx released this 15 Nov 01:50

Added

  • Role hierarchy. Roles carry a rank (set in rbac.ranks, applied by rbac:sync). An actor may only assign or remove a role strictly below their highest rank.
  • Rbac::assign(), Rbac::unassign(), HasRbac::assignRole() and removeRole() accept an optional actor (by:). Without one nothing is checked, as before.
  • Rbac::rankOf() and Rbac::canAssign().
  • RoleAssignmentDenied exception, 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

Choose a tag to compare

@siberfx siberfx released this 15 Nov 01:42

First stable release of siberfx/rbac-permission.

  • Permission grammar module.resource.verb@scope with 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:sync and more

See CHANGELOG.md for the full list.