示例#1
0
 /**
  * Gets credentials the user must have to access this action.
  *
  * @return mixed An array or a string describing the credentials the user must have to access this action
  */
 public function getCredential()
 {
     $credentials = parent::getCredential();
     if (!dmConfig::get('site_active')) {
         $credentials = (array) $credentials;
         $credentials[] = 'site_view';
     }
     return $credentials;
 }
示例#2
0
 /**
  * Returns the permissions of a dmUser for given $action and $user.
  *
  * @param Doctrine_Query $query
  * @param dmBaseActions $action
  * @param DmUser $user
  * @param Doctrine::HYDRATION_* $hydrationMode
  */
 public function getModelPermissions(dmBaseActions $action, $user, $hydrationMode = Doctrine::HYDRATE_ARRAY)
 {
     $cacheKey = sprintf('recordPermissionsQuery_%s_%s_%d_%s', $action->getModuleName(), $action->getActionName(), $user->get($this->getIdentifier()), $hydrationMode);
     if (!$this->hasCache($cacheKey)) {
         return $this->setCache($cacheKey, $this->getRecordsPermissions(array('module' => $action->getModuleName(), 'action' => $action->getActionName(), 'model' => $action->getDmModule()->getOption('model')), $user, $hydrationMode));
     }
     return $this->getCache($cacheKey);
 }