* [ticket#1773,done,0.2h] filter no priv projects.
This commit is contained in:
@@ -1688,7 +1688,7 @@ class bug extends control
|
||||
public function ajaxGetProjects(int $productID, string $branch = '', int $projectID = 0, string $pageType = '')
|
||||
{
|
||||
$product = $this->loadModel('product')->fetchByID($productID);
|
||||
$projectPairs = $product->shadow ? $this->loadModel('project')->getPairs(false, 'noproduct,noclosed') : array();
|
||||
$projectPairs = $product->shadow ? $this->loadModel('project')->getPairs(false, 'noproduct,noclosed,haspriv') : array();
|
||||
$projects = $this->product->getProjectPairsByProduct($productID, $branch, array_keys($projectPairs));
|
||||
if($this->app->getViewType() == 'json') return print(json_encode($projects));
|
||||
if($pageType == 'old') return print(html::select('project', array(0 => '') + $projects, $projectID, "class='form-control' onchange='loadProductExecutions({$productID}, this.value)'"));
|
||||
|
||||
+1
-1
@@ -1176,7 +1176,7 @@ class bugZen extends bug
|
||||
if(!empty($bug->execution) && empty($executions[$bug->execution]) && !in_array($execution->attribute, $unAllowedStage)) $executions[$execution->id] = $execution->name . "({$this->lang->bug->deleted})";
|
||||
|
||||
/* Get project pairs. */
|
||||
$projectPairs = $product->shadow ? $this->loadModel('project')->getPairs(false, 'noproduct,noclosed') : array();
|
||||
$projectPairs = $product->shadow ? $this->loadModel('project')->getPairs(false, 'noproduct,noclosed,haspriv') : array();
|
||||
$projects = $this->product->getProjectPairsByProduct($bug->product, (string)$bug->branch, array_keys($projectPairs));
|
||||
if(!empty($bug->project) && empty($projects[$bug->project]))
|
||||
{
|
||||
|
||||
@@ -730,19 +730,20 @@ class projectModel extends model
|
||||
* Get project pairs.
|
||||
*
|
||||
* @param bool $ignoreVision
|
||||
* @param string $param
|
||||
* @param string $params
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getPairs(bool $ignoreVision = false, string $param = '')
|
||||
public function getPairs(bool $ignoreVision = false, string $params = '')
|
||||
{
|
||||
return $this->dao->select('id, name')->from(TABLE_PROJECT)
|
||||
->where('type')->eq('project')
|
||||
->andWhere('deleted')->eq(0)
|
||||
->beginIF(!$ignoreVision)->andWhere('vision')->eq($this->config->vision)->fi()
|
||||
->beginIF(strpos($param, 'noproduct') !== false)->andWhere('hasProduct')->eq(0)->fi()
|
||||
->beginIF(strpos($param, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi()
|
||||
->beginIF(strpos($param, 'nosprint') !== false)->andWhere('multiple')->eq('0')->fi()
|
||||
->beginIF(strpos($params, 'noproduct') !== false)->andWhere('hasProduct')->eq(0)->fi()
|
||||
->beginIF(strpos($params, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi()
|
||||
->beginIF(strpos($params, 'nosprint') !== false)->andWhere('multiple')->eq('0')->fi()
|
||||
->beginIF(!$this->app->user->admin && strpos($params, 'haspriv') !== false)->andWhere('id')->in($this->app->user->view->projects)->fi()
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user