Skip to content

Releases: webrek/laravel-mongo-permission

v1.6.1

Choose a tag to compare

@webrek webrek released this 08 Jun 05:26

Fixed

  • Removed the property accessors added in 1.6.0 ($role->permissions, $user->roles, $permission->roles, …). Under mongodb/laravel-mongodb a same-named method is resolved as a relation, so accessing them as properties threw LogicException: … must return a relationship instance. Use the methods instead: $role->permissions(), $user->roles(), $role->users(), $permission->roles().

Added

  • Tests for the inverse relation methods, including Role::users() against both flat and structured role_ids.

v1.5.0

Choose a tag to compare

@webrek webrek released this 08 Jun 03:55

Changed

  • Dropped Laravel 10/11 and PHP 8.1 (both past security support / no longer installable cleanly). Targets Laravel 12 / PHP 8.2+; composer.json, README and CI matrix aligned.

Fixed

  • Deleting a role/permission now also removes legacy flat id references from users (not just structured subdocs) — no more orphaned ids.
  • Cache invalidation on role/permission changes: editing/deleting a role or permission (incl. raw model saves, e.g. from an admin panel) now invalidates cached entries via a cache-generation bump. Previously rememberForever could leave permissions stale indefinitely.

Added

  • PermissionRegistrar::bumpCacheVersion() / cacheVersion(); cache key includes the generation.
  • Mutation testing (Infection) in CI (MSI ~88% / covered ~95%).

v1.4.0

Choose a tag to compare

@webrek webrek released this 08 Jun 03:23

Fixed

  • Read assignments stored in the legacy flat form (a plain array of id strings, e.g. written by Maklad) in addition to the structured subdocument form. Previously hasRole(), hasPermissionTo(), roles() and permissions() returned nothing for users whose role_ids/permission_ids were flat string arrays — causing role:/permission: middleware to 403 those users. Both forms now coexist (legacy data works and is upgraded in place on assign). Applied across HasRoles, HasPermissions and PermissionRegistrar via a shared Support\\Entry normaliser.

Added

  • Support\\Entry helper normalising an entry (flat string or structured array) to {id, team_id, expires_at}.

Note

  • Single-tenant apps (e.g. Metrix) should set 'teams' => false in config/permission.php.