luizpinheiro / acl
A simple and model-independent Access Control List manager
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/luizpinheiro/acl
Requires
- php: >=5.6.4
- illuminate/support: 5.3.*
This package is auto-updated.
Last update: 2025-11-26 17:40:55 UTC
README
WARNING: this library is currently under construction.
With this library you can check against a role-based permission list to control access to your application. It is completely model-independent, eg. you can (actually you must) define your own implementation of roles, permission and group management.
The library provides 3 contracts (interfaces) to help you contruct your managements classes. You
don't need to implement all the 3 interfaces. If you want to check only the use permissions and dont
want to create roles or groups, you only need to implement the PermissionsManagerContract.
If you want to group the permissions into roles and associate the roles to users, you must implement
the RolesManagerContract. And if you want to organize roles (and permissions) into groups, you
must implement the GroupsManagerContract.
Go to the /examples directory to find some sample codes.
In the below snippet we assume that $roleManager implements de RolesManagerContract.
#Put this on the boostrap of your application use ACL\ACL; ACL::setRolesManager($roleManager) ACL::setPermissionsManager($permissionsManager); ACL::setGroupsManager($groupsManager); #you should tell the ACL who is the user, you should do this in your authorization #layer ACL::setUserId($user_id); #now you can check if the user has the permission ACL::hasPermission('documents.delete');