一个灵活,基于驱动器PHP 5.4+的Acl包:Lock

jopen 9年前

一个灵活,基于驱动器PHP 5.4+的Acl包:Lock



Terminology

  • Caller: An identity object that can have permissions to do something
  • Driver: A storage system for permissions which can either be static or persistent
  • Permission: A permission holds an action and an optional (unique) resource. Can be either a Restriction or a Privilege
  • 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 do
  • Resource: 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'];      }  }

项目主页:http://www.open-open.com/lib/view/home/1417503626900