コード例 #1
0
ファイル: dmFrontBaseActions.php プロジェクト: jdart/diem
 /**
  * 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);
 }