* Fix bug#16734

This commit is contained in:
zenggang
2021-11-26 03:00:16 +00:00
parent ff9601584f
commit 7a53ada4b3
5 changed files with 142 additions and 86 deletions
+42 -39
View File
@@ -76,45 +76,48 @@ $lang->action->periods['lastweek'] = $lang->action->dynamic->lastWeek;
$lang->action->periods['thismonth'] = $lang->action->dynamic->thisMonth;
$lang->action->periods['lastmonth'] = $lang->action->dynamic->lastMonth;
$lang->action->objectTypes['product'] = $lang->productCommon;
$lang->action->objectTypes['branch'] = 'Branch';
$lang->action->objectTypes['story'] = $lang->SRCommon;
$lang->action->objectTypes['design'] = 'Design';
$lang->action->objectTypes['productplan'] = 'Plan';
$lang->action->objectTypes['release'] = 'Release';
$lang->action->objectTypes['program'] = 'Program';
$lang->action->objectTypes['project'] = 'Project';
$lang->action->objectTypes['execution'] = $lang->executionCommon;
$lang->action->objectTypes['task'] = 'Task';
$lang->action->objectTypes['build'] = 'Build';
$lang->action->objectTypes['job'] = 'Job';
$lang->action->objectTypes['bug'] = 'Bug';
$lang->action->objectTypes['case'] = 'Case';
$lang->action->objectTypes['caseresult'] = 'Case Result';
$lang->action->objectTypes['stepresult'] = 'Case Steps';
$lang->action->objectTypes['caselib'] = 'Library';
$lang->action->objectTypes['testsuite'] = 'Suite';
$lang->action->objectTypes['testtask'] = 'Test Build';
$lang->action->objectTypes['testreport'] = 'Report';
$lang->action->objectTypes['doc'] = 'Document';
$lang->action->objectTypes['api'] = 'Interface';
$lang->action->objectTypes['doclib'] = 'Document Library';
$lang->action->objectTypes['apistruct'] = 'API struct';
$lang->action->objectTypes['todo'] = 'Todo';
$lang->action->objectTypes['risk'] = 'Risk';
$lang->action->objectTypes['issue'] = 'Issue';
$lang->action->objectTypes['module'] = 'Module';
$lang->action->objectTypes['user'] = 'User';
$lang->action->objectTypes['stakeholder'] = 'Stakeholder';
$lang->action->objectTypes['budget'] = 'Cost Estimate';
$lang->action->objectTypes['entry'] = 'Entry';
$lang->action->objectTypes['webhook'] = 'Webhook';
$lang->action->objectTypes['team'] = 'Team';
$lang->action->objectTypes['whitelist'] = 'Whitelist';
$lang->action->objectTypes['pipeline'] = 'GitLab';
$lang->action->objectTypes['gitlab'] = 'GitLab';
$lang->action->objectTypes['jenkins'] = 'Jenkins';
$lang->action->objectTypes['mr'] = 'Merge Request';
$lang->action->objectTypes['product'] = $lang->productCommon;
$lang->action->objectTypes['branch'] = 'Branch';
$lang->action->objectTypes['story'] = $lang->SRCommon;
$lang->action->objectTypes['design'] = 'Design';
$lang->action->objectTypes['productplan'] = 'Plan';
$lang->action->objectTypes['release'] = 'Release';
$lang->action->objectTypes['program'] = 'Program';
$lang->action->objectTypes['project'] = 'Project';
$lang->action->objectTypes['execution'] = $lang->executionCommon;
$lang->action->objectTypes['task'] = 'Task';
$lang->action->objectTypes['build'] = 'Build';
$lang->action->objectTypes['job'] = 'Job';
$lang->action->objectTypes['bug'] = 'Bug';
$lang->action->objectTypes['case'] = 'Case';
$lang->action->objectTypes['caseresult'] = 'Case Result';
$lang->action->objectTypes['stepresult'] = 'Case Steps';
$lang->action->objectTypes['caselib'] = 'Library';
$lang->action->objectTypes['testsuite'] = 'Suite';
$lang->action->objectTypes['testtask'] = 'Test Build';
$lang->action->objectTypes['testreport'] = 'Report';
$lang->action->objectTypes['doc'] = 'Document';
$lang->action->objectTypes['api'] = 'Interface';
$lang->action->objectTypes['doclib'] = 'Document Library';
$lang->action->objectTypes['apistruct'] = 'API struct';
$lang->action->objectTypes['todo'] = 'Todo';
$lang->action->objectTypes['risk'] = 'Risk';
$lang->action->objectTypes['issue'] = 'Issue';
$lang->action->objectTypes['module'] = 'Module';
$lang->action->objectTypes['user'] = 'User';
$lang->action->objectTypes['stakeholder'] = 'Stakeholder';
$lang->action->objectTypes['budget'] = 'Cost Estimate';
$lang->action->objectTypes['entry'] = 'Entry';
$lang->action->objectTypes['webhook'] = 'Webhook';
$lang->action->objectTypes['team'] = 'Team';
$lang->action->objectTypes['whitelist'] = 'Whitelist';
$lang->action->objectTypes['pipeline'] = 'GitLab';
$lang->action->objectTypes['gitlab'] = 'GitLab';
$lang->action->objectTypes['jenkins'] = 'Jenkins';
$lang->action->objectTypes['mr'] = 'Merge Request';
$lang->action->objectTypes['gitlabproject'] = 'GitLab Project';
$lang->action->objectTypes['gitlabuser'] = 'GitLab User';
$lang->action->objectTypes['gitlabgroup'] = 'GitLab Group';
/* Used to describe operation history. */
$lang->action->desc = new stdclass();
+42 -39
View File
@@ -76,45 +76,48 @@ $lang->action->periods['lastweek'] = $lang->action->dynamic->lastWeek;
$lang->action->periods['thismonth'] = $lang->action->dynamic->thisMonth;
$lang->action->periods['lastmonth'] = $lang->action->dynamic->lastMonth;
$lang->action->objectTypes['product'] = $lang->productCommon;
$lang->action->objectTypes['branch'] = '分支';
$lang->action->objectTypes['story'] = $lang->SRCommon;
$lang->action->objectTypes['design'] = '设计';
$lang->action->objectTypes['productplan'] = '计划';
$lang->action->objectTypes['release'] = '发布';
$lang->action->objectTypes['program'] = '项目集';
$lang->action->objectTypes['project'] = '项目';
$lang->action->objectTypes['execution'] = $config->systemMode == 'new' ? '执行' : $lang->executionCommon;
$lang->action->objectTypes['task'] = '任务';
$lang->action->objectTypes['build'] = '版本';
$lang->action->objectTypes['job'] = '构建';
$lang->action->objectTypes['bug'] = 'Bug';
$lang->action->objectTypes['case'] = '用例';
$lang->action->objectTypes['caseresult'] = '用例结果';
$lang->action->objectTypes['stepresult'] = '用例步骤';
$lang->action->objectTypes['caselib'] = '用例库';
$lang->action->objectTypes['testsuite'] = '套件';
$lang->action->objectTypes['testtask'] = '测试单';
$lang->action->objectTypes['testreport'] = '报告';
$lang->action->objectTypes['doc'] = '文档';
$lang->action->objectTypes['api'] = '接口';
$lang->action->objectTypes['doclib'] = '文档库';
$lang->action->objectTypes['apistruct'] = '数据结构';
$lang->action->objectTypes['todo'] = '待办';
$lang->action->objectTypes['risk'] = '风险';
$lang->action->objectTypes['issue'] = '问题';
$lang->action->objectTypes['module'] = '模块';
$lang->action->objectTypes['user'] = '用户';
$lang->action->objectTypes['stakeholder'] = '干系人';
$lang->action->objectTypes['budget'] = '费用估算';
$lang->action->objectTypes['entry'] = '应用';
$lang->action->objectTypes['webhook'] = 'Webhook';
$lang->action->objectTypes['team'] = '团队';
$lang->action->objectTypes['whitelist'] = '白名单';
$lang->action->objectTypes['pipeline'] = 'GitLab';
$lang->action->objectTypes['gitlab'] = 'GitLab';
$lang->action->objectTypes['jenkins'] = 'Jenkins';
$lang->action->objectTypes['mr'] = '合并请求';
$lang->action->objectTypes['product'] = $lang->productCommon;
$lang->action->objectTypes['branch'] = '分支';
$lang->action->objectTypes['story'] = $lang->SRCommon;
$lang->action->objectTypes['design'] = '设计';
$lang->action->objectTypes['productplan'] = '计划';
$lang->action->objectTypes['release'] = '发布';
$lang->action->objectTypes['program'] = '项目集';
$lang->action->objectTypes['project'] = '项目';
$lang->action->objectTypes['execution'] = $config->systemMode == 'new' ? '执行' : $lang->executionCommon;
$lang->action->objectTypes['task'] = '任务';
$lang->action->objectTypes['build'] = '版本';
$lang->action->objectTypes['job'] = '构建';
$lang->action->objectTypes['bug'] = 'Bug';
$lang->action->objectTypes['case'] = '用例';
$lang->action->objectTypes['caseresult'] = '用例结果';
$lang->action->objectTypes['stepresult'] = '用例步骤';
$lang->action->objectTypes['caselib'] = '用例库';
$lang->action->objectTypes['testsuite'] = '套件';
$lang->action->objectTypes['testtask'] = '测试单';
$lang->action->objectTypes['testreport'] = '报告';
$lang->action->objectTypes['doc'] = '文档';
$lang->action->objectTypes['api'] = '接口';
$lang->action->objectTypes['doclib'] = '文档库';
$lang->action->objectTypes['apistruct'] = '数据结构';
$lang->action->objectTypes['todo'] = '待办';
$lang->action->objectTypes['risk'] = '风险';
$lang->action->objectTypes['issue'] = '问题';
$lang->action->objectTypes['module'] = '模块';
$lang->action->objectTypes['user'] = '用户';
$lang->action->objectTypes['stakeholder'] = '干系人';
$lang->action->objectTypes['budget'] = '费用估算';
$lang->action->objectTypes['entry'] = '应用';
$lang->action->objectTypes['webhook'] = 'Webhook';
$lang->action->objectTypes['team'] = '团队';
$lang->action->objectTypes['whitelist'] = '白名单';
$lang->action->objectTypes['pipeline'] = 'GitLab';
$lang->action->objectTypes['gitlab'] = 'GitLab';
$lang->action->objectTypes['jenkins'] = 'Jenkins';
$lang->action->objectTypes['mr'] = '合并请求';
$lang->action->objectTypes['gitlabproject'] = 'GitLab项目';
$lang->action->objectTypes['gitlabuser'] = 'GitLab用户';
$lang->action->objectTypes['gitlabgroup'] = 'GitLab群组';
/* 用来描述操作历史记录。*/
$lang->action->desc = new stdclass();
+3
View File
@@ -977,6 +977,9 @@ class actionModel extends model
/* If action type is login or logout, needn't link. */
if($actionType == 'svncommited' or $actionType == 'gitcommited') $action->actor = zget($commiters, $action->actor);
/* Get gitlab objectname. */
if(substr($objectType, 0,6) == 'gitlab') $action->objectName = $action->extra;
/* Other actions, create a link. */
if(!$this->setObjectLink($action, $deptUsers))
{
+31 -3
View File
@@ -374,8 +374,16 @@ class gitlab extends control
{
if($confirm != 'yes') die(js::confirm($this->lang->gitlab->group->confirmDelete , inlink('deleteGroup', "gitlabID=$gitlabID&groupID=$groupID&confirm=yes")));
$group = $this->gitlab->apiGetSingleGroup($gitlabID, $groupID);
$reponse = $this->gitlab->apiDeleteGroup($gitlabID, $groupID);
if(!$reponse or substr($reponse->message, 0, 2) == '20') die(js::reload('parent'));
/* If the status code beginning with 20 is returned or empty is returned, it is successful. */
if(!$reponse or substr($reponse->message, 0, 2) == '20')
{
$this->loadModel('action')->create('gitlabgroup', $groupID, 'deleted', '', $group->name);
die(js::reload('parent'));
}
die(js::alert($reponse->message));
}
@@ -568,8 +576,20 @@ class gitlab extends control
{
if($confirm != 'yes') die(js::confirm($this->lang->gitlab->user->confirmDelete , inlink('deleteUser', "gitlabID=$gitlabID&userID=$userID&confirm=yes")));
$user = $this->gitlab->apiGetSingleUser($gitlabID, $userID);
$reponse = $this->gitlab->apiDeleteUser($gitlabID, $userID);
if(!$reponse or substr($reponse->message, 0, 2) == '20') die(js::reload('parent')); /* If the status code beginning with 20 is returned or empty is returned, it is successful. */
/* If the status code beginning with 20 is returned or empty is returned, it is successful. */
if(!$reponse or substr($reponse->message, 0, 2) == '20')
{
$this->loadModel('action')->create('gitlabuser', $userID, 'deleted', '', $user->name);
/* Delete user bind. */
$this->dao->delete()->from(TABLE_OAUTH)->where('providerType')->eq('gitlab')->andWhere('providerID')->eq($gitlabID)->andWhere('openID')->eq($userID)->exec();
die(js::reload('parent'));
}
die(js::alert($reponse->message));
}
@@ -679,8 +699,16 @@ class gitlab extends control
{
if($confirm != 'yes') die(js::confirm($this->lang->gitlab->project->confirmDelete , inlink('deleteProject', "gitlabID=$gitlabID&projectID=$projectID&confirm=yes")));
$project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID);
$reponse = $this->gitlab->apiDeleteProject($gitlabID, $projectID);
if(substr($reponse->message, 0, 2) == '20') die(js::reload('parent')); /* If the status code beginning with 20 is returned or empty is returned, it is successful. */
/* If the status code beginning with 20 is returned or empty is returned, it is successful. */
if(!$reponse or substr($reponse->message, 0, 2) == '20')
{
$this->loadModel('action')->create('gitlabproject', $projectID, 'deleted', '', $project->name);
die(js::reload('parent'));
}
die(js::alert($reponse->message));
}
+24 -5
View File
@@ -2033,7 +2033,11 @@ class gitlabModel extends model
$reponse = $this->apiCreateProject($gitlabID, $project);
if(!empty($reponse->id)) return true;
if(!empty($reponse->id))
{
$this->loadModel('action')->create('gitlabproject', $reponse->id, 'created', '', $reponse->name);
return true;
}
return $this->apiErrorHandling($reponse);
}
@@ -2053,8 +2057,11 @@ class gitlabModel extends model
$reponse = $this->apiUpdateProject($gitlabID, $project);
if(!empty($reponse->id)) return true;
if(!empty($reponse->id))
{
$this->loadModel('action')->create('gitlabproject', $project->id, 'edited', '', $project->name);
return true;
}
return $this->apiErrorHandling($reponse);
}
@@ -2096,6 +2103,8 @@ class gitlabModel extends model
if(!empty($reponse->id))
{
$this->loadModel('action')->create('gitlabuser', $reponse->id, 'created', '', $reponse->name);
/* Bind user. */
if($user->account)
{
@@ -2154,6 +2163,8 @@ class gitlabModel extends model
if(!empty($reponse->id))
{
$this->loadModel('action')->create('gitlabuser', $reponse->id, 'edited', '', $reponse->name);
/* Bind user. */
if($user->account && $changeBind)
{
@@ -2187,7 +2198,11 @@ class gitlabModel extends model
$reponse = $this->apiCreateGroup($gitlabID, $group);
if(!empty($reponse->id)) return true;
if(!empty($reponse->id))
{
$this->loadModel('action')->create('gitlabgroup', $reponse->id, 'created', '', $reponse->name);
return true;
}
return $this->apiErrorHandling($reponse);
}
@@ -2208,7 +2223,11 @@ class gitlabModel extends model
$reponse = $this->apiUpdateGroup($gitlabID, $group);
if(!empty($reponse->id)) return true;
if(!empty($reponse->id))
{
$this->loadModel('action')->create('gitlabgroup', $reponse->id, 'edited', '', $reponse->name);
return true;
}
return $this->apiErrorHandling($reponse);
}