示例#1
0
 public function deleteAction()
 {
     $roleId = $this->_getParam('id');
     $roleRow = $this->aclModel->getRoleById($roleId);
     if (!$roleRow or $roleRow->getIsSystemRole()) {
         throw new Exception('Invalid role');
     }
     $delete = $this->aclModel->deleteRole($roleRow);
     if (!$delete['status']) {
         $this->view->messageError = $delete['messageError'];
     }
     $this->_forward('index');
 }
示例#2
0
 public function init()
 {
     if (!Zend_Auth::getInstance()->hasIdentity()) {
         return;
     }
     $this->_helper->getHelper('contextSwitch')->addActionContext('insert', array('json'))->addActionContext('edit', array('json'))->setAutoJsonSerialization(true)->initContext();
     // Contextos dos actions
     $this->_helper->getHelper('ajaxContext')->addActionContext('index', array('html'))->initContext();
     $this->aclModel = Zend_Registry::get('acl');
     $this->userAuth = Zend_Auth::getInstance()->getIdentity();
     $this->roleRow = $this->aclModel->getRoleById($this->userAuth->getRoleId(), false);
     $this->roleAppraiserId = Zend_Registry::get('config')->acl->roleAppraiserId;
     $this->userModel = new Model_User();
     $this->dbTable_User = new DbTable_User();
     $this->userRoleModel = new Model_UserRole();
     $this->positionModel = new Model_Position();
     $this->regionalModel = new Model_Regional();
     $this->dbTable_Regional = new DbTable_Regional();
     $this->educationModel = new Model_Education();
     $this->userLocalityModel = new Model_UserLocality();
 }
示例#3
0
 public static function isGestor($loggedUser = null)
 {
     if (!$loggedUser) {
         $loggedUser = Zend_Auth::getInstance()->getIdentity();
     }
     if (!$loggedUser) {
         return false;
     }
     $aclModel = new Model_Acl();
     $userRoleId = $loggedUser->getRoleId();
     $roleRow = $aclModel->getRoleById($userRoleId);
     if ($roleRow->getIsSystemAdmin() == 1) {
         return true;
     }
     $managerRoleId = Zend_Registry::get('config')->acl->roleGestorId;
     return $userRoleId == $managerRoleId;
 }