/** * Administra el men� */ public function manageAction() { $this->view->validatorScripts = false; $this->setTitle('Configuraci�n de Facultades'); $this->view->actions = Query\SecurityActionQuery::create()->find(); $this->view->controllers = Query\SecurityControllerQuery::create()->addAscendingOrderBy(Bean\SecurityAction::NAME)->find(); $menu = $this->getMenu(); $this->view->menuItems = $menu->render($menu->getFullMenu(), new ManagerMenuRenderer($this->getBaseUrl())); }
/** * */ public function configAction() { parent::init(); $this->setTitle('Configuracion de Facultades'); $this->view->accessRoles = Query\AccessRoleQuery::create()->whereAdd(Bean\AccessRole::STATUS, 1)->find(); $this->view->actions = Query\SecurityActionQuery::create()->find(); $this->view->controllers = $a = Query\SecurityControllerQuery::create()->find(); $this->view->permissions = $this->getCatalog('AccessRoleCatalog')->getAllPermissions(); }
/** * Analiza nuestro workspace, lee los controllers, sus actions, las agrega a la base de datos */ public function analizeWorkspace() { foreach (array_keys($this->controllers) as $baseControllerName) { $controllerName = $this->underscore(substr($baseControllerName, 0, -10)); $controller = Query\SecurityControllerQuery::create()->whereAdd(Bean\SecurityController::NAME, $controllerName)->findOne(); if (!$controller instanceof Bean\SecurityController) { $controller = Factory\SecurityControllerFactory::createFromArray(array('name' => $controllerName)); $this->securityControllerCatalog->create($controller); } foreach ($this->getActionsByController($baseControllerName) as $actionName) { $actionName = $this->underscore(substr($actionName, 0, -6)); $action = Query\SecurityActionQuery::create()->whereAdd(Bean\SecurityAction::NAME, $actionName)->whereAdd(Bean\SecurityAction::ID_CONTROLLER, $controller->getIdController())->setLimit(1)->findOne(); if (!$action instanceof Bean\SecurityAction) { $action = Factory\SecurityActionFactory::createFromArray(array('name' => $actionName, 'id_controller' => $controller->getIdController())); $this->securityActionCatalog->create($action); } } } }
/** * Obtiene el nombre de la action * @param int $idAction * @param string */ private function getControllerURI($idAction) { if (is_null($idAction)) { return ''; } $action = Query\SecurityActionQuery::create()->pk($idAction)->findOne(); $controller = Query\SecurityControllerQuery::create()->pk($action->getIdController())->findOne(); return $controller->getName(); }
/** * Obtiene las SecurityActions de la base de datos * @return array */ protected function getSecurityActionsFromDatabase() { $securityActionCollection = Query\SecurityActionQuery::create()->find(); $controllers = Query\SecurityControllerQuery::create()->find()->toCombo(); $securityActions = array(); while ($securityActionCollection->valid()) { $securityAction = $securityActionCollection->read(); $controllerName = $controllers[$securityAction->getIdController()]; $actionName = $securityAction->getName(); $securityActions[$securityAction->getIdAction()] = $controllerName . '/' . $actionName; } return $securityActions; }