/** * Applies user principals to the cache of the model. * Public to the world for testing */ public function refreshUser() { $this->agaviUser = $this->getContext()->getUser(); if ($this->agaviUser->isAuthenticated() === true) { $this->user = $this->agaviUser->getNsmUser(); $this->principals = $this->user->getPrincipalsArray(); } }
public function initialize(AgaviContext $context, array $parameters = array()) { parent::initialize($context, $parameters); $this->config = (include AgaviConfigCache::checkConfig(AgaviToolkit::expandDirectives('%core.module_dir%/Api/config/icingaCommands.xml'))); $this->user = $context->getUser(); if ($this->user->getNsmUser()->hasTarget('IcingaCommandRestrictions')) { $this->filterCommandsByUser($this->config); } }
public function initialize(AgaviContext $context, array $parameters = array()) { parent::initialize($context, $parameters); $this->agaviUser = $this->getContext()->getUser(); if ($this->agaviUser->isAuthenticated() === true) { $this->user = $this->agaviUser->getNsmUser(); $this->setPrincipals($this->user->getPrincipalsArray()); } else { throw new AppKitModelException('The model need an authenticated user'); } $this->initializeXmlData(); if (!isset($parameters['lazy'])) { $this->cronks = $this->getCronks(true); } }
private function getCacheFile() { $prefix = 'cache_' . $this->uniqueCacheIdentifier . '_' . $this->user->getNsmUser()->user_name . '_' . sha1($this->getCacheKey()) . '.json'; return $this->cacheDir . '/' . $prefix; }
private function getNewFilename($extension) { $username = $this->__user->getNsmUser()->user_name; $md5 = md5($username . '-' . microtime(true) . '-' . getmypid()); return sprintf('%s_%s.%s', $username, $md5, $extension); }