Example #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 Admin_Model_Modules($moduleDirectory);
     $transitions = Controller_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;
 }
Example #2
0
 public function loadWorkflowResources($acl)
 {
     $resources = Controller_Helper_Workflow::getWorkflowResources();
     $acl->addResource(new Zend_Acl_Resource('workflow'));
     foreach ($resources as $resource) {
         $acl->addResource(new Zend_Acl_Resource($resource), 'workflow');
     }
 }