* Adjust check is bind user.

This commit is contained in:
liyuchun
2022-01-21 11:06:58 +08:00
parent 1a26aeba04
commit 13a49268e7
2 changed files with 21 additions and 5 deletions
+4 -5
View File
@@ -42,18 +42,17 @@ class gitlab extends control
$pager = new pager($recTotal, $recPerPage, $pageID);
/* Admin user don't need bind. */
$isBindUser = (int)$this->app->user->admin;
$gitlabList = $this->gitlab->getList($orderBy, $pager);
$myGitLabs = $this->gitlab->getGitLabListByAccount();
foreach($gitlabList as $gitlab)
{
$token = $this->gitlab->apiGetCurrentUser($gitlab->url, $gitlab->token);
$gitlab->isAdminToken = (isset($token->is_admin) and $token->is_admin);
if(!$isBindUser) $isBindUser = (int)$this->gitlab->getUserIDByZentaoAccount($gitlab->id, $this->app->user->account);
$gitlab->isBindUser = $isBindUser;
$gitlab->isBindUser = true;
if(!$this->app->user->admin and !isset($myGitLabs[$gitlab->id])) $gitlab->isBindUser = false;
}
$this->view->title = $this->lang->gitlab->common . $this->lang->colon . $this->lang->gitlab->browse;
$this->view->gitlabList = $gitlabList;
$this->view->orderBy = $orderBy;