From 9b20bfdf192efe55e0d4a90e9b8e37bbe999d3a3 Mon Sep 17 00:00:00 2001 From: lichengjun Date: Thu, 19 Aug 2021 08:20:09 +0000 Subject: [PATCH 1/3] * Adjust jihuMR zh. --- module/gitlab/lang/zh-cn.php | 1 + 1 file changed, 1 insertion(+) diff --git a/module/gitlab/lang/zh-cn.php b/module/gitlab/lang/zh-cn.php index 4a37a0cbc4..f48412f833 100644 --- a/module/gitlab/lang/zh-cn.php +++ b/module/gitlab/lang/zh-cn.php @@ -40,6 +40,7 @@ $lang->gitlab->placeholder->token = "请填写具有admin权限账户的access t $lang->gitlab->noImportableIssues = "目前没有可供导入的issue。"; $lang->gitlab->tokenError = "当前token非管理员权限。"; +$lang->gitlab->tokenLimit = "GitLab Token权限不足,无法使用当前功能。请更换为有管理员权限的GitLab Token。"; $lang->gitlab->hostError = "无效的GitLab服务地址。"; $lang->gitlab->bindUserError = "不能重复绑定用户 %s"; $lang->gitlab->importIssueError = "未选择该issue所属的执行。"; From b14f5af220d695fc53bdeab0fb0dcb4b9a10ed6f Mon Sep 17 00:00:00 2001 From: lichengjun Date: Thu, 19 Aug 2021 08:28:59 +0000 Subject: [PATCH 2/3] * Add GitLab Token authority verification. --- module/gitlab/control.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/module/gitlab/control.php b/module/gitlab/control.php index 50a2c8f94f..4128af9db8 100644 --- a/module/gitlab/control.php +++ b/module/gitlab/control.php @@ -101,6 +101,11 @@ class gitlab extends control { $userPairs = $this->loadModel('user')->getPairs(); + $gitlab = $this->gitlab->getByID($gitlabID); + $user = $this->gitlab->apiGetCurrentUser($gitlab->url, $gitlab->token); + if(!isset($user->is_admin) or !$user->is_admin) die(js::alert($this->lang->gitlab->tokenLimit) . js::locate($this->createLink('gitlab', 'edit', array('gitlabID' => $gitlabID)))); + + if($_POST) { $users = $this->post->zentaoUsers; @@ -140,7 +145,6 @@ class gitlab extends control return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->server->http_referer)); } - $gitlab = $this->gitlab->getByID($gitlabID); $zentaoUsers = $this->dao->select('account,email,realname')->from(TABLE_USER)->fetchAll('account'); $this->view->title = $this->lang->gitlab->bindUser; From 5537f3500a43c43943e878a74c4bdd53726fcc0a Mon Sep 17 00:00:00 2001 From: Guan Xiying Date: Thu, 19 Aug 2021 16:32:40 +0800 Subject: [PATCH 3/3] * Remove extra line. --- module/gitlab/control.php | 1 - 1 file changed, 1 deletion(-) diff --git a/module/gitlab/control.php b/module/gitlab/control.php index 4128af9db8..2d38990e42 100644 --- a/module/gitlab/control.php +++ b/module/gitlab/control.php @@ -105,7 +105,6 @@ class gitlab extends control $user = $this->gitlab->apiGetCurrentUser($gitlab->url, $gitlab->token); if(!isset($user->is_admin) or !$user->is_admin) die(js::alert($this->lang->gitlab->tokenLimit) . js::locate($this->createLink('gitlab', 'edit', array('gitlabID' => $gitlabID)))); - if($_POST) { $users = $this->post->zentaoUsers;