Exemplo n.º 1
0
 /**
  * Checks whether the provider can be accessed by this consumer.
  *
  * @param Doozr_Acl_Service $acl    The provider ACL
  * @param string            $action The action to check
  *
  * @author Benjamin Carl <*****@*****.**>
  * @return bool TRUE if is allowed, otherwise FALSE
  * @access public
  * @throws Doozr_Exception_Service
  */
 public function isAllowed(Doozr_Acl_Service $acl, $action)
 {
     if ($this->getType() === self::TYPE_CONSUMER && $acl->getType() === self::TYPE_PROVIDER) {
         return $acl->hasPermission($action) && $acl->grant($this->getPermissions(), $action);
     } else {
         throw new Doozr_Exception_Service('Type mismatch! Only Consumer ca be allowed to access Provider.');
     }
 }