示例#1
0
 protected function _initAcl()
 {
     $isRedirect = false;
     if (!parent::_initAcl()) {
         $isRedirect = true;
     } else {
         $username = $this->auth->getUsername();
         $this->aclAdmin = new Vi_Acl($username);
         Vi_Registry::set('aclAdmin', $this->aclAdmin);
         //		    echo '<pre>';print_r($this->aclAdmin);die;
         $isRedirect = !$this->aclAdmin->checkPermission('access', 'application::' . Vi_Registry::getAppName());
     }
     if ($isRedirect && Vi_Registry::getModuleName() != 'access') {
         $url = "";
         $module = Vi_Registry::getModuleName();
         $controller = Vi_Registry::getControllerName();
         $action = Vi_Registry::getActionName();
         $params = $this->_request->getParams();
         $url .= $module . '/' . $controller . '/' . $action . '/';
         unset($params[Vi_Registry::getModuleKey()]);
         unset($params[Vi_Registry::getControllerKey()]);
         unset($params[Vi_Registry::getActionKey()]);
         //			echo "<pre>";print_r($params);die;
         foreach ($params as $key => $param) {
             $url .= @urlencode($key) . '/' . @urlencode($param);
         }
         $this->_setCallBackUrl($url);
         if (null != $this->auth->getUsername()) {
             $this->session->accessMessage = Vi_Language::translate("You don't have permission to access this application");
         }
         $this->_redirect("access/admin/login");
     }
     return true;
 }
示例#2
0
 /**
  * Check permisison
  * 
  * @param string $permission
  * @param string $module
  * @param string|integer $expandId  Note: $expandId == '*": Check to have all expandable permisisnon
  *                                        $expandId == '?': Check to have one or more permisison
  *                                        $expandId is interger: Check for special expand value
  */
 public function checkPermission($permission, $module = null, $expandId = '*')
 {
     if (null === $module) {
         $module = Vi_Registry::getModuleName();
     }
     if (null == $this->acl && false === $this->_initAcl()) {
         return false;
     }
     return $this->acl->checkPermission($permission, $module, $expandId);
 }
示例#3
0
 public static function getHelperUrl()
 {
     $moduleName = Vi_Registry::getModuleName();
     return Vi_Registry::get('BASE_URL') . "modules/{$moduleName}/views/helpers/";
 }