Пример #1
0
 /**
  *
  */
 public function grantvalidateAction()
 {
     $res = $this->_getParam('res');
     $role = $this->_getParam('role');
     $allow = $this->_getParam('allow');
     $grant = Zupal_Grants::getInstance()->findOne(array('resource' => $res, 'role' => $role));
     if (!$grant) {
         $grant = new Zupal_Grants();
         $grant->resource = $res;
         $grant->role = $role;
     }
     if (strcasecmp('null', $allow)) {
         $grant->allow = $allow;
         $grant->save();
     } else {
         $grant->delete();
     }
     $this->_forward('grants');
 }
Пример #2
0
 public function __construct()
 {
     foreach (Zupal_Roles::getInstance()->findAll() as $role) {
         $this->addRole($role->as_acl_role());
     }
     foreach (Zupal_Grants::getInstance()->findAll() as $grant) {
         if ($grant->allow) {
             $this->allow($grant->role, $grant->resource, $privileges, $assert);
         }
     }
 }
Пример #3
0
 function grants($pReload = FALSE)
 {
     if ($pReload || is_null($this->_grants)) {
         $this->_grants = Zupal_Grants::getInstance()->find(array('role' => $this->identity()), 'role');
     }
     return $this->_grants;
 }