Пример #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;
 }
Пример #2
0
 protected function _updateRole($roleId, $name)
 {
     if (!empty($roleId)) {
         $role = new Opus_UserRole($roleId);
     } else {
         $role = new Opus_UserRole();
     }
     $oldName = $role->getName();
     if (!empty($name) && !in_array($name, self::$_protectedRoles)) {
         $role->setName($name);
     }
     $role->store();
 }
Пример #3
0
 /** Get OAI-Visibility according to the Role.
  *
  * @param string
  * @return boolean
  */
 private function getVisibilityInOai($subdir)
 {
     if (strpos($subdir, "original") === 0 || strpos($subdir, "html") === 0) {
         return false;
     }
     if (!is_null($this->roleId)) {
         $role = new Opus_UserRole($this->roleId);
         if ($role->getName() == 'guest') {
             return true;
         }
     }
     return false;
 }