* finish task #6694.

This commit is contained in:
wangyidong
2019-12-19 08:17:01 +08:00
parent 44ca492421
commit ed5f700a86
2 changed files with 33 additions and 14 deletions
+15 -6
View File
@@ -548,6 +548,7 @@ class bug extends control
/* Judge bug exits or not. */
$bug = $this->bug->getById($bugID, true);
if(!$bug) die(js::error($this->lang->notFound) . js::locate('back'));
$this->bug->checkBugProjectPriv($bug);
/* Update action. */
if($bug->assignedTo == $this->app->user->account) $this->loadModel('action')->read('bug', $bugID);
@@ -645,6 +646,7 @@ class bug extends control
$productID = $bug->product;
$projectID = $bug->project;
$currentModuleID = $bug->module;
$this->bug->checkBugProjectPriv($bug);
/* Set the menu. */
$this->bug->setMenu($this->products, $productID, $bug->branch);
@@ -828,6 +830,7 @@ class bug extends control
public function assignTo($bugID)
{
$bug = $this->bug->getById($bugID);
$this->bug->checkBugProjectPriv($bug);
/* Set menu. */
$this->bug->setMenu($this->products, $bug->product, $bug->branch);
@@ -961,8 +964,9 @@ class bug extends control
die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent'));
}
$bug = $this->bug->getById($bugID);
$productID = $bug->product;
$bug = $this->bug->getById($bugID);
$productID = $bug->product;
$this->bug->checkBugProjectPriv($bug);
$this->bug->setMenu($this->products, $productID, $bug->branch);
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->confirmBug;
@@ -1045,6 +1049,7 @@ class bug extends control
if(!isset($users[$assignedTo])) $assignedTo = $this->bug->getModuleOwner($bug->module, $productID);
unset($this->lang->bug->resolutionList['tostory']);
$this->bug->checkBugProjectPriv($bug);
$this->bug->setMenu($this->products, $productID, $bug->branch);
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->resolve;
@@ -1111,8 +1116,9 @@ class bug extends control
die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent'));
}
$bug = $this->bug->getById($bugID);
$productID = $bug->product;
$bug = $this->bug->getById($bugID);
$productID = $bug->product;
$this->bug->checkBugProjectPriv($bug);
$this->bug->setMenu($this->products, $productID, $bug->branch);
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->activate;
@@ -1157,8 +1163,9 @@ class bug extends control
}
}
$bug = $this->bug->getById($bugID);
$productID = $bug->product;
$bug = $this->bug->getById($bugID);
$productID = $bug->product;
$this->bug->checkBugProjectPriv($bug);
$this->bug->setMenu($this->products, $productID, $bug->branch);
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->close;
@@ -1185,6 +1192,7 @@ class bug extends control
/* Get bug and queryID. */
$bug = $this->bug->getById($bugID);
$queryID = ($browseType == 'bySearch') ? (int)$param : 0;
$this->bug->checkBugProjectPriv($bug);
/* Set the menu. */
$this->bug->setMenu($this->products, $bug->product, $bug->branch);
@@ -1287,6 +1295,7 @@ class bug extends control
public function confirmStoryChange($bugID)
{
$bug = $this->bug->getById($bugID);
$this->bug->checkBugProjectPriv($bug);
$this->dao->update(TABLE_BUG)->set('storyVersion')->eq($bug->latestStoryVersion)->where('id')->eq($bugID)->exec();
$this->loadModel('action')->create('bug', $bugID, 'confirmed', '', $bug->latestStoryVersion);
die(js::reload('parent'));
+18 -8
View File
@@ -400,6 +400,24 @@ class bugModel extends model
return $bug;
}
/**
* Check bug project priv.
*
* @param object $bug
* @access public
* @return void
*/
public function checkBugProjectPriv($bug)
{
if($bug->project and !$this->loadModel('project')->checkPriv($bug->project))
{
echo(js::alert($this->lang->bug->projectAccessDenied));
$loginLink = $this->config->requestType == 'GET' ? "?{$this->config->moduleVar}=user&{$this->config->methodVar}=login" : "user{$this->config->requestFix}login";
if(strpos($this->server->http_referer, $loginLink) !== false) die(js::locate(helper::createLink('bug', 'index')));
die(js::locate('back'));
}
}
/**
* Get bugs of a module.
*
@@ -464,14 +482,6 @@ class bugModel extends model
->where('t1.id')->eq((int)$bugID)->fetch();
if(!$bug) return false;
if($bug->project and !$this->loadModel('project')->checkPriv($bug->project))
{
echo(js::alert($this->lang->bug->projectAccessDenied));
$loginLink = $this->config->requestType == 'GET' ? "?{$this->config->moduleVar}=user&{$this->config->methodVar}=login" : "user{$this->config->requestFix}login";
if(strpos($this->server->http_referer, $loginLink) !== false) die(js::locate(inlink('index')));
die(js::locate('back'));
}
$bug = $this->loadModel('file')->replaceImgURL($bug, 'steps');
if($setImgSize) $bug->steps = $this->file->setImgSize($bug->steps);
foreach($bug as $key => $value) if(strpos($key, 'Date') !== false and !(int)substr($value, 0, 4)) $bug->$key = '';