yxvt / beermission
简单且灵活的角色与权限系统
1.0.2
2020-08-24 13:06 UTC
Requires
- php: ^7.4
Requires (Dev)
- phpstan/phpstan: ^0.12.37
- phpunit/phpunit: ^9.4@dev
This package is not auto-updated.
Last update: 2024-10-01 10:22:47 UTC
README
简单且灵活的角色与权限系统。
用法
一旦你的载体实体设置完成,你可以按照以下方式确定它是否应该被授予访问受保护资源的权限。
$this->acl ->bearer($this->bearer) ->that(static function (RequiredGrantBuilder $grantBuilder): void { $grantBuilder->hasRole('Role', 'RoleScope', 'RoleScopeValue'); $grantBuilder->hasPermission('Permission', 'PermissionScope', 'PermissionScopeValue'); }) ->shouldBeGrantedAccessWhen() ->hasAllExpectedGrants();