zielony / conditionacl
Simple access-control list with conditions
Installs: 20
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/zielony/conditionacl
Requires
- php: >=7.3
- symfony/yaml: ^3.0
Requires (Dev)
- phpspec/prophecy-phpunit: ^2.0
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2025-09-29 03:13:31 UTC
README
Conditionacl is an implementation of a simple access-control list (ACL) system that also takes external conditions into account when validating the rules.
Example usage:
$aclFactory = new AclFactory(new YamlFileConfig('...'));
$acl = $aclFactory->fromRole('project-reader');
$user1 = new Domain\User(1, 'user1');
$user2 = new Domain\User(2, 'user2');
$project = new Domain\Project(1, 'first', $user1);
$acl->hasPermissionTo('read', 'project', new Condition\IfUserIsProjectsOwner($user1, $project));
// true
$acl->hasPermissionTo('read', 'project', new Condition\IfUserIsProjectsOwner($user2, $project));
// false