一个灵活,基于驱动器PHP 5.4+的Acl包:Lock
jopen
10年前
一个灵活,基于驱动器PHP 5.4+的Acl包:Lock
Terminology
Caller
: An identity object that can have permissions to do somethingDriver
: A storage system for permissions which can either be static or persistentPermission
: A permission holds an action and an optional (unique) resource. Can be either aRestriction
or aPrivilege
Restriction
: A restriction denies you from being able to perform an action (on an optional resource)Privilege
: A privilege allows you to perform an action (on an optional resource)Action
: An action is something you are either allowed or denied to doResource
: A resource can be an object where you can perform one or more actions on. It can either target a certain type of resource or a specific resource by its unique identifier
Features
- Flexible Acl permissions for multiple identities (callers)
- Static or persistent drivers to store permissions
- Action aliases
- Roles
- Conditions (Asserts)
- Easily Implement acl functionality on your caller with a trait
<?php use BeatSwitch\Lock\Contracts\Caller; class User implements Caller { public function getCallerType() { return 'users'; } public function getCallerId() { return $this->id; } public function getCallerRoles() { return ['editor', 'publisher']; } }