kelunik / access-control
Role based access control.
dev-master
2016-04-24 16:55 UTC
Requires (Dev)
- phpunit/phpunit: ^5
This package is auto-updated.
Last update: 2024-11-15 07:37:43 UTC
README
kelunik/access-control
is a role based access control system.
Requirements
- PHP 7.0+
Installation
composer require kelunik/access-control
Usage
$guest = new SimpleRole("guest", ["read"]); $member = new CombinedRole("member", [$guest], ["read.internal"]); $student = new CombinedRole("student", [$guest, $member], ["write.internal"]); $staff = new CombinedRole("staff", [$guest, $member], ["write"]); $accessControl = new AccessControl([ $guest, $member, $student, $staff ]); $isAllowed = $accessControl->isGranted(["member", "staff"], "write");