Merge branch 'zentaopms_239'

This commit is contained in:
wangyidong
2022-11-08 08:41:28 +08:00
458 changed files with 9419 additions and 4940 deletions
+27 -1
View File
@@ -91,7 +91,8 @@ class repoModel extends model
return $output;
}
$dropMenuLink = helper::createLink('repo', 'ajaxGetDropMenu', "repoID=$repoID&module=$currentModule&method=$currentMethod");
$projectID = $this->app->tab == 'project' ? $this->get->objectID : 0;
$dropMenuLink = helper::createLink('repo', 'ajaxGetDropMenu', "repoID=$repoID&module=$currentModule&method=$currentMethod&projectId=$projectID");
$output = "<div class='btn-group header-btn' id='swapper'><button data-toggle='dropdown' type='button' class='btn' id='currentItem' title='{$currentRepoName}'><span class='text'>{$currentRepoName}</span> <span class='caret' style='margin-bottom: -1px'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList' data-url='$dropMenuLink'>";
$output .= '<div class="input-control search-box has-icon-left has-icon-right search-example"><input type="search" class="form-control search-input" /><label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label><a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a></div>'; $output .= "</div></div>";
@@ -200,6 +201,7 @@ class repoModel extends model
->skipSpecial('path,client,account,password')
->setDefault('product', '')
->join('product', ',')
->setDefault('projects', '')->join('projects', ',')
->get();
$data->acl = empty($data->acl) ? '' : json_encode($data->acl);
@@ -265,6 +267,7 @@ class repoModel extends model
->setDefault('product', '')
->skipSpecial('path,client,account,password')
->join('product', ',')
->setDefault('projects', '')->join('projects', ',')
->get();
if($data->path != $repo->path) $data->synced = 0;
@@ -2175,4 +2178,27 @@ class repoModel extends model
return $url;
}
/**
* Remove projects without privileges.
*
* @param array $productIDList
* @param array $projectIDList
* @access public
* @return array
*/
public function filterProject($productIDList, $projectIDList = array())
{
/* Get all projects that can be accessed. */
$accessProjects = array();
foreach($productIDList as $productID)
{
$projects = $this->loadModel('product')->getProjectPairsByProduct($productID);
$accessProjects = $accessProjects + $projects;
}
/* Get linked projects. */
$linkedProjects = $this->dao->select('id,name')->from(TABLE_PROJECT)->where('id')->in($projectIDList)->fetchPairs('id', 'name');
return $accessProjects + $linkedProjects; // Merge projects can be accessed and exists.
}
}