diff --git a/framework/base/router.class.php b/framework/base/router.class.php index f01484d775..2edcc0d071 100644 --- a/framework/base/router.class.php +++ b/framework/base/router.class.php @@ -694,11 +694,18 @@ class baseRouter public function setVision() { $account = isset($_SESSION['user']) ? $_SESSION['user']->account : ''; + if(empty($account) and isset($_POST['account'])) $account = $_POST['account']; + if(empty($account) and isset($_GET['account'])) $account = $_GET['account']; + $vision = ''; if($this->config->installed) $vision = $this->dbh->query("SELECT * FROM " . TABLE_CONFIG . " WHERE owner = '$account' AND `key` = 'vision' LIMIT 1")->fetch(); + if($vision) $vision = $vision->value; if(!empty($_SESSION['user']->visions) and empty($vision)) list($vision) = explode(',', $_SESSION['user']->visions); - $this->config->vision = $vision ? $vision->value : 'rnd'; + list($defaultVision) = explode(',', trim($this->config->visions, ',')); + if($vision and strpos($this->config->visions, ",{$vision},") === false) $vision = $defaultVision; + + $this->config->vision = $vision ? $vision : $defaultVision; } /** diff --git a/module/block/control.php b/module/block/control.php index 37051d7726..f0c3690fb1 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -1701,6 +1701,7 @@ class block extends control */ public function printAssignToMeBlock($longBlock = true) { + $hasViewPriv = array(); if(common::hasPriv('todo', 'view')) $hasViewPriv['todo'] = true; if(common::hasPriv('task', 'view')) $hasViewPriv['task'] = true; if(common::hasPriv('bug', 'view')) $hasViewPriv['bug'] = true; diff --git a/module/bug/model.php b/module/bug/model.php index 65a8a45bcb..ad7f3f6425 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -1357,15 +1357,16 @@ class bugModel extends model * @param int $bugID * @param string $browseType * @param int $queryID + * @param object $pager * @access public * @return array */ - public function getBugs2Link($bugID, $browseType = 'bySearch', $queryID = 0, $pager) + public function getBugs2Link($bugID, $browseType = 'bySearch', $queryID = 0, $pager = null) { if($browseType == 'bySearch') { $bug = $this->getById($bugID); - $bugIDList = $bug->id . ',' . $bug->linkBug; + $bugIDList = $bug->id . ',' . $bug->linkBug; $bugs2Link = $this->getBySearch($bug->product, 'all', $queryID, 'id', $bugIDList, $pager); return $bugs2Link; } diff --git a/module/my/control.php b/module/my/control.php index 42ba8edbea..72d2cb2056 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -1273,6 +1273,10 @@ EOF; { $_SESSION['vision'] = $vision; $this->loadModel('setting')->setItem("{$this->app->user->account}.common.global.vision", $vision); + $this->config->vision = $vision; + + $_SESSION['user']->rights = $this->loadModel('user')->authorize($this->app->user->account); + echo js::locate($this->createLink('my', 'index'), 'parent'); } } diff --git a/module/user/control.php b/module/user/control.php index 40fde16ca4..21651689b9 100644 --- a/module/user/control.php +++ b/module/user/control.php @@ -977,6 +977,7 @@ class user extends control /* Check deny type. */ $rights = $this->app->user->rights['rights']; $acls = $this->app->user->rights['acls']; + $module = strtolower($module); $method = strtolower($method); diff --git a/module/user/model.php b/module/user/model.php index 75a1839fcd..0d09c394ec 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -1026,6 +1026,13 @@ class userModel extends model $projectAdminGroupID = $this->dao->select('id')->from(TABLE_GROUP)->where('role')->eq('projectAdmin')->fetch('id'); $canManageProjects = $this->dao->select('project')->from(TABLE_USERGROUP)->where('`group`')->eq($projectAdminGroupID)->andWhere('account')->eq($account)->fetch('project'); } + + /* Set basic priv when no any priv. */ + if(empty($rights)) + { + $rights['index']['index'] = 1; + $rights['my']['index'] = 1; + } return array('rights' => $rights, 'acls' => $acls, 'projects' => $canManageProjects); }