Пример #1
0
 /**
  * Action for showing list of modules and permissions.
  *
  * @throws Exception
  */
 public function listmoduleAction()
 {
     $id = $this->getRequest()->getParam('roleid');
     if ($id == null) {
         throw new Exception('Role ID missing');
     }
     $role = new Opus_UserRole($id);
     $roleModules = $role->listAccessModules();
     if ($role->getName() !== 'guest') {
         $guest = Opus_UserRole::fetchByName('guest');
         $guestModules = $guest->listAccessModules();
         // Role 'guest' has always access to 'default' module
         if (!in_array('default', $guestModules)) {
             $guestModules[] = 'default';
         }
         $this->view->guestModules = $guestModules;
     } else {
         // Role 'guest' has alreays access to 'default' module
         if (!in_array('default', $roleModules)) {
             $roleModules[] = 'default';
         }
     }
     $moduleDirectory = dirname($this->getFrontController()->getModuleDirectory());
     $modulesModel = new Application_Util_Modules($moduleDirectory);
     $transitions = Application_Controller_Action_Helper_Workflow::getWorkflowResources();
     $this->view->loginNames = $role->getAllAccountNames();
     $this->view->roleId = $role->getId();
     $this->view->roleName = $role->getName();
     $this->view->modules = $roleModules;
     $this->view->allModules = $modulesModel->getAll();
     $this->view->allResources = $this->getAllResources();
     $this->view->allWorkflow = $transitions;
 }