Merge branch 'devops_caoyanyi' into 'devops20'
Devops caoyanyi See merge request easycorp/zentaopms!1566
This commit is contained in:
@@ -314,7 +314,7 @@ class gitlab extends control
|
||||
}
|
||||
|
||||
$groups = $this->gitlab->apiGetGroups($gitlabID, $orderBy);
|
||||
$adminGroups = $this->gitlab->apiGetGroups($gitlabID, $orderBy, $this->config->gitlab->accessLevel['owner']);
|
||||
$adminGroups = $this->gitlab->apiGetGroups($gitlabID, $orderBy, $this->config->gitlab->accessLevel['maintainer']);
|
||||
|
||||
$adminGropuIDList = array();
|
||||
foreach($adminGroups as $group) $adminGropuIDList[] = $group->id;
|
||||
|
||||
@@ -155,7 +155,7 @@ class gitlabModel extends model
|
||||
{
|
||||
if(!$account) $account = $this->app->user->account;
|
||||
|
||||
return $this->dao->select('providerID')->from(TABLE_OAUTH)
|
||||
return $this->dao->select('providerID,openID')->from(TABLE_OAUTH)
|
||||
->where('providerType')->eq('gitlab')
|
||||
->andWhere('account')->eq($account)
|
||||
->fetchPairs('providerID');
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<td class='text' title='<?php echo substr($gitlabGroup->created_at, 0, 10);?>'><?php echo substr($gitlabGroup->created_at, 0, 10);?></td>
|
||||
<td class='c-actions text-left'>
|
||||
<?php
|
||||
$adminClass = in_array($gitlabGroup->id, $adminGropuIDList) ? '' : 'disabled';
|
||||
$adminClass = ($app->user->admin or in_array($gitlabGroup->id, $adminGropuIDList)) ? '' : 'disabled';
|
||||
common::printLink('gitlab', 'manageGroupMembers', "gitlabID=$gitlabID&groupID=$gitlabGroup->id", "<i class='icon icon-team'></i> ", '',"title='{$lang->gitlab->group->manageMembers}' class='btn btn-primary'");
|
||||
common::printLink('gitlab', 'editGroup', "gitlabID=$gitlabID&groupID=$gitlabGroup->id", "<i class='icon icon-edit'></i> ", '', "title='{$lang->gitlab->group->edit}' class='btn btn-primary {$adminClass}'");
|
||||
if(common::hasPriv('gitlab', 'delete')) echo html::a($this->createLink('gitlab', 'deleteGroup', "gitlabID=$gitlabID&groupID=$gitlabGroup->id"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->gitlab->deleteGroup}' class='btn {$adminClass}'");
|
||||
|
||||
@@ -53,6 +53,9 @@ class mr extends control
|
||||
/* Load lang from compile module */
|
||||
$this->app->loadLang('compile');
|
||||
|
||||
$openIDList = array();
|
||||
if(!$this->app->user->admin) $openIDList = $this->loadModel('gitlab')->getGitLabListByAccount($this->app->user->account);
|
||||
|
||||
$this->view->title = $this->lang->mr->common . $this->lang->colon . $this->lang->mr->browse;
|
||||
$this->view->MRList = $MRList;
|
||||
$this->view->projects = $projects;
|
||||
@@ -61,6 +64,7 @@ class mr extends control
|
||||
$this->view->param = $param;
|
||||
$this->view->objectID = $objectID;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->openIDList = $openIDList;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -190,8 +194,12 @@ class mr extends control
|
||||
|
||||
$MR = $this->mr->getByID($id);
|
||||
|
||||
if($MR->synced)
|
||||
{
|
||||
$res = $this->mr->apiDeleteMR($MR->gitlabID, $MR->targetProject, $MR->mriid);
|
||||
if(isset($res->message)) return print(js::alert($this->mr->convertApiError($res->message)));
|
||||
}
|
||||
$this->dao->delete()->from(TABLE_MR)->where('id')->eq($id)->exec();
|
||||
$this->mr->apiDeleteMR($MR->gitlabID, $MR->targetProject, $MR->mriid);
|
||||
|
||||
die(js::locate(inlink('browse'), 'parent'));
|
||||
}
|
||||
|
||||
@@ -113,10 +113,12 @@ $lang->mr->closeSuccess = "Merge request closed.";
|
||||
$lang->mr->apiErrorMap[1] = "You can't use same project/branch for source and target";
|
||||
$lang->mr->apiErrorMap[2] = "/Another open merge request already exists for this source branch: !([0-9]+)/";
|
||||
$lang->mr->apiErrorMap[3] = "401 Unauthorized";
|
||||
$lang->mr->apiErrorMap[4] = "403 Forbidden";
|
||||
|
||||
$lang->mr->errorLang[1] = 'The source project branch cannot be the same as the target project branch';
|
||||
$lang->mr->errorLang[2] = 'Another open merge request already exists for this source branch: ID%u';
|
||||
$lang->mr->errorLang[3] = "Unauthorized";
|
||||
$lang->mr->errorLang[4] = 'Permission denied';
|
||||
|
||||
$lang->mr->from = "from";
|
||||
$lang->mr->to = "to";
|
||||
|
||||
@@ -113,10 +113,12 @@ $lang->mr->closeSuccess = "已关闭合并请求。";
|
||||
$lang->mr->apiErrorMap[1] = "You can't use same project/branch for source and target";
|
||||
$lang->mr->apiErrorMap[2] = "/Another open merge request already exists for this source branch: !([0-9]+)/";
|
||||
$lang->mr->apiErrorMap[3] = "401 Unauthorized";
|
||||
$lang->mr->apiErrorMap[4] = "403 Forbidden";
|
||||
|
||||
$lang->mr->errorLang[1] = '源项目分支与目标项目分支不能相同';
|
||||
$lang->mr->errorLang[2] = '存在另外一个同样的合并请求在源项目分支中: ID%u';
|
||||
$lang->mr->errorLang[3] = '权限不足';
|
||||
$lang->mr->errorLang[4] = '权限不足';
|
||||
|
||||
$lang->mr->from = "从";
|
||||
$lang->mr->to = "合并到";
|
||||
|
||||
@@ -82,11 +82,12 @@
|
||||
<?php endif;?>
|
||||
<td class='c-actions'>
|
||||
<?php
|
||||
$canDelete = ($app->user->admin or $projects[$MR->gitlabID][$MR->sourceProject]->owner->id === $openIDList[$MR->gitlabID]) ? '' : 'disabled';
|
||||
common::printLink('mr', 'view', "mr={$MR->id}", '<i class="icon icon-eye"></i>', '', "title='{$lang->mr->view}' class='btn btn-info'");
|
||||
common::printIcon('mr', 'edit', "mr={$MR->id}", $MR, 'list');
|
||||
common::printLink('mr', 'diff', "mr={$MR->id}", '<i class="icon icon-diff"></i>', '', "title='{$lang->mr->viewDiff}' class='btn btn-info'");
|
||||
common::printLink('mr', 'link', "mr={$MR->id}", '<i class="icon icon-link"></i>', '', "title='{$lang->mr->link}' class='btn btn-info'" . ($MR->linkButton == false ? 'disabled' : ''));
|
||||
common::printLink('mr', 'delete', "mr={$MR->id}", '<i class="icon icon-trash"></i>', 'hiddenwin', "title='{$lang->mr->delete}' class='btn btn-info'");
|
||||
common::printLink('mr', 'delete', "mr={$MR->id}", '<i class="icon icon-trash"></i>', 'hiddenwin', "title='{$lang->mr->delete}' class='btn btn-info {$canDelete}'");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user