Access controll list - mhmxs/lisaframework GitHub Wiki

Access Control List in LISA

Access Control List

In access control you can create groups and accounts, and add accounts to groups, or groups to other groups easily. The main class for the library is the libraries/Util/ACL/ACL.php.

ACL library functions:

  • createGroup($group) create a group if not exists in library
\Util\ACL\ACL::init()->createGroup(new \Util\ACL\Group("editors"));
  • createAccount($account) create accounht in libraray if not exists
\Util\ACL\ACL::init()->createAccount(new \Util\ACL\Account("Joe"));
  • delete($access) delete account or group from library
\Util\ACL\ACL::init()->delete(new \Util\ACL\Account("Joe"));
  • allow($access, $group) allow account or group to an other group. The $access can be ACLAccount or ACLGroup, and the $group is the name the group which will include the $access.
\Util\ACL\ACL::init()->allow(new \Util\ACL\Account("Sam"), new \Util\ACL\Group("admin"));
  • deny($access, $group) deny $access from $group
\Util\ACL\ACL::init()->deny(new \Util\ACL\Group("bloggers"), new \Util\ACL\Group("editors"));
  • isAllowed($access, $group) check $access access in $group
$isAllowed = \Util\ACL\ACL::init()->isAllowed(new \Util\ACL\Account("Joe"), new \Util\ACL\Group("admin"));
  • getGroups($access) returns with $acces's all groups recursive
$acl = new \Util\ACL\ACL();
$JoesGroups = $acl->getGroups(new \Util\ACL\Account("Joe"));
$AdminsGroups = $acl->getGroups(new \Util\ACL\Group("editors"));
  • getMembers($group) returns with all group members recursive
$members = \Util\ACL\ACL::init()->getMembers(new \Util\ACL\Group("bloggers"));