Search by

hypervel / permission

albertchtbinaryfire

Role and permission management for Hypervel Eloquent models.

Package info

github.com/hypervel/permission

Issues

pkg:composer/hypervel/permission

Statistics

Installs: 2 520

Dependents: 0

Suggesters: 0

Stars: 0

v0.3.28 2025-12-26 06:18 UTC

README

Documentation: https://hypervel.org/docs/permission

Differences From Spatie Laravel Permission

  • Hypervel adds denied permissions. A denied assignment wins over direct or role-granted allows, and the migration stores each assignment's effect in an is_denied column, so assigning allow or deny for the same model or role and permission updates the existing assignment. getDirectPermissions(), getPermissionsViaRoles(), getAllPermissions(), and getPermissionNames() return effective allowed permissions only; getDeniedPermissions() returns the denied ones.
  • The Wildcard contract adds getDeniedIndex(), so wildcard checks apply denies through the same matching as allows: a denied pattern blocks the names it matches. Custom wildcard classes implement it alongside getIndex().
  • Role and permission inputs accept unit enums as well as backed enums. Unit enums use their case names.
  • Hypervel adds opt-in row partitioning through PermissionRegistrar::resolvePartitionUsing(...). The stock migration is unpartitioned; applications that enable partitioning own a partitioned schema.
  • The cache configuration uses expiration_seconds instead of expiration_time, with separate named cache keys so role, model-role, model-permission, and assignment-token caches can be invalidated independently.
  • The cache store must keep values and refreshable atomic locks on the same backend, because concurrent cache fills are coordinated with a lock. Stack and failover stores are not supported.
  • The cache store and keys are worker-wide, and initializeCache() is for boot and tests. Instead of switching the cache per tenant during a request, use row partitioning, which also separates each tenant's cache entries.
  • Cached roles and permissions returned by lookups are shared within the current request or job, and lookups use indexes built when the catalog loads. Save a changed role or permission before looking up roles or permissions again. See caching.
  • There is no Octane reset listener or register_octane_reset_listener option. The current team and the loaded permission catalog are coroutine-local, so nothing carries over between requests.

Ported from: https://github.com/spatie/laravel-permission