Example #1
0
 /**
  * Verifies the current user is allowed $privilege on $entity
  *
  * @param  Entity  $entity
  * @param  String  $privilege
  * @return void
  * @throws AuthorizerException
  */
 protected function verifySetAuth(Entity $entity, $privilege)
 {
     if (!$this->setAuth->isAllowed($entity, $privilege)) {
         throw new AuthorizerException(sprintf('User %d is not allowed to %s resource %s #%d', $this->auth->getUserId(), $privilege, $entity->getResource(), $entity->getId()));
     }
 }
Example #2
0
 /**
  * Get all allowed privs on an Entity
  * @param  Entity $entity
  * @return Array
  */
 protected function getAllowedPrivs(Entity $entity)
 {
     return $this->auth->getAllowedPrivs($entity);
 }