yxvt/beermission

Simple and flexible roles & permission system

1.0.2 2020-08-24 13:06 UTC

This package is not auto-updated.

Last update: 2024-10-01 10:22:47 UTC


README

Simple and flexible roles & permission system.

Usage

Once your Bearer entity is set up, you can determine if it should be granted access to your protected resource in the following fashion.

$this->acl
    ->bearer($this->bearer)
    ->that(static function (RequiredGrantBuilder $grantBuilder): void {
        $grantBuilder->hasRole('Role', 'RoleScope', 'RoleScopeValue');
        $grantBuilder->hasPermission('Permission', 'PermissionScope', 'PermissionScopeValue');
    })
    ->shouldBeGrantedAccessWhen()
    ->hasAllExpectedGrants();