コード例 #1
0
 /**
  * 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();
     }
 }
 private function checkAuthorisation()
 {
     if (!$this->user->isAuthenticated()) {
         return false;
     }
     if (!$this->user->hasCredential("appkit.api.access") && !$this->user->hasCredential("icinga.user")) {
         return false;
     }
     return true;
 }
コード例 #3
0
 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);
     }
 }