From ba542db8973f0f38e445629bfdbf92ff01a51010 Mon Sep 17 00:00:00 2001 From: zenggang Date: Wed, 18 May 2022 02:25:43 +0000 Subject: [PATCH] * Finish task#54208 --- db/update16.5.sql | 2 ++ module/gitlab/model.php | 5 +++-- module/repo/control.php | 5 +++-- module/repo/js/create.js | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/db/update16.5.sql b/db/update16.5.sql index b801aad61a..88ebe0bf53 100644 --- a/db/update16.5.sql +++ b/db/update16.5.sql @@ -467,3 +467,5 @@ UPDATE `zt_workflowaction` SET `method`='browse' WHERE module='product' and `act UPDATE `zt_workflowaction` SET `type` ='single' WHERE `action`='browse' AND `type`='batch' AND `buildin`=1; UPDATE `zt_workflowaction` SET `show`='direct' WHERE `buildin`=1; + +UPDATE `zt_project` SET `status` = 'doing' WHERE `type` = 'program' and `status` = 'wait' and `realBegan` != '0000-00-00' and `realBegan` != ''; diff --git a/module/gitlab/model.php b/module/gitlab/model.php index 54ed60e29a..5701df2163 100644 --- a/module/gitlab/model.php +++ b/module/gitlab/model.php @@ -690,12 +690,13 @@ class gitlabModel extends model * @param string $simple * @param int $minID * @param int $maxID + * @param bool $sudo * @access public * @return array */ - public function apiGetProjects($gitlabID, $simple = 'true', $minID = 0, $maxID = 0) + public function apiGetProjects($gitlabID, $simple = 'true', $minID = 0, $maxID = 0, $sudo = true) { - $apiRoot = $this->getApiRoot($gitlabID); + $apiRoot = $this->getApiRoot($gitlabID, $sudo); if(!$apiRoot) return array(); $url = sprintf($apiRoot, "/projects"); diff --git a/module/repo/control.php b/module/repo/control.php index 928c3dc7d2..2effb41c2f 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -1152,9 +1152,10 @@ class repo extends control */ public function ajaxGetGitlabProjects($gitlabID, $projectIdList = '', $filter = '') { - if($this->app->user->admin) + $showAll = ($filter == 'ALL' and common::hasPriv('repo', 'create')) ? true : false; + if($this->app->user->admin or $showAll) { - $projects = $this->loadModel('gitlab')->apiGetProjects($gitlabID); + $projects = $this->loadModel('gitlab')->apiGetProjects($gitlabID, true, 0, 0, false); } else { diff --git a/module/repo/js/create.js b/module/repo/js/create.js index 53011c9ce5..c515bbd787 100644 --- a/module/repo/js/create.js +++ b/module/repo/js/create.js @@ -10,7 +10,7 @@ $(function() $('#gitlabHost').change(function() { host = $('#gitlabHost').val(); - url = createLink('repo', 'ajaxgetgitlabprojects', "host=" + host); + url = createLink('repo', 'ajaxgetgitlabprojects', "host=" + host + "&projectIdList=&filter=ALL"); if(host == '') return false; $.get(url, function(response)