Пример #1
0
 public function getActions($action = null, $being = null, $id = false)
 {
     #		$cache = $this->cacheManager->getCache('Admin_ActionCache');
     #		$identifier = sha1($action.$being.$id.$this->adapter);
     #		if(!$cache->has($identifier) && false){
     $actions = array();
     foreach ($this->reflectionService->getAllImplementationClassNamesForInterface('Admin\\Core\\Actions\\ActionInterface') as $actionClassName) {
         $inheritingClasses = $this->reflectionService->getAllSubClassNamesForClass($actionClassName);
         foreach ($inheritingClasses as $inheritingClass) {
             $inheritedObject = new $inheritingClass($this->getAdapter(), $this->request, $this->view, $this);
             if ($inheritedObject->override($actionClassName, $being)) {
                 $actionClassName = $inheritedObject;
             }
             unset($inheritedObject);
         }
         #$a = $this->objectManager->create($actionClassName, $this->getAdapter(), $this->request, $this->view, $this);
         $a = new $actionClassName($this->getAdapter(), $this->request, $this->view, $this);
         if ($a->canHandle($being, $action, $id)) {
             if ($this->securityManager->isAllowed($being, $a->getAction())) {
                 $actionName = \Admin\Core\Helper::getShortName($actionClassName);
                 $actionName = str_replace("Action", "", $actionName);
                 $actions[$actionName] = $a;
             }
         }
     }
     ksort($actions);
     #$cache->set($identifier,$actions);
     #		}else{
     #			$actions = $cache->get($identifier);
     #		}
     return $actions;
 }
Пример #2
0
 public function isUserSuperAdmin()
 {
     $superAdminUserName = $this->getSettings("Admin.SuperAdmin");
     $user = $this->securityManager->getUser();
     if (is_object($user)) {
         return $user->__toString() == $superAdminUserName;
     }
     return false;
 }