* Finish task #44802.
This commit is contained in:
@@ -468,7 +468,7 @@ class gitlab extends control
|
||||
}
|
||||
|
||||
/* Get gitlab users data. */
|
||||
$gitlabUserList = $this->gitlab->apiGetUsers($gitlabID);
|
||||
$gitlabUserList = $this->gitlab->apiGetUsers($gitlabID, true);
|
||||
$gitlabUsers = array(''=>'');
|
||||
foreach($gitlabUserList as $gitlabUser)
|
||||
{
|
||||
|
||||
@@ -451,10 +451,11 @@ class gitlabModel extends model
|
||||
* Get gitlab user list.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @param bool $onlyLinked
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function apiGetUsers($gitlabID)
|
||||
public function apiGetUsers($gitlabID, $onlyLinked = false)
|
||||
{
|
||||
/* GitLab API '/users' can only return 20 users per page in default, so we use a loop to fetch all users. */
|
||||
$page = 1;
|
||||
@@ -478,9 +479,15 @@ class gitlabModel extends model
|
||||
|
||||
if(!$response) return array();
|
||||
|
||||
/* Get linked users. */
|
||||
$linkedUsers = array();
|
||||
if($onlyLinked) $linkedUsers = $this->getUserIdAccountPairs($gitlabID);
|
||||
|
||||
$users = array();
|
||||
foreach($response as $gitlabUser)
|
||||
{
|
||||
if(!isset($linkedUsers[$gitlabUser->id])) continue;
|
||||
|
||||
$user = new stdclass;
|
||||
$user->id = $gitlabUser->id;
|
||||
$user->realname = $gitlabUser->name;
|
||||
@@ -2121,7 +2128,7 @@ class gitlabModel extends model
|
||||
/* Check whether the user has been bind. */
|
||||
if($user->account)
|
||||
{
|
||||
$zentaoBindUser = $this->dao->select('account')->from(TABLE_OAUTH)->where('providerType')->eq('gitlab')->andWhere('providerID')->eq($gitlabID)->andWhere('account')->eq($user->account)->fetch();
|
||||
$zentaoBindUser = $this->dao->select('account,openID')->from(TABLE_OAUTH)->where('providerType')->eq('gitlab')->andWhere('providerID')->eq($gitlabID)->andWhere('account')->eq($user->account)->fetch();
|
||||
$changeBind = (!$zentaoBindUser or $zentaoBindUser->openID != $user->id) ? true : false;
|
||||
if($zentaoBindUser && $changeBind)
|
||||
{
|
||||
|
||||
@@ -47,8 +47,8 @@
|
||||
<td class='c-actions text-left'>
|
||||
<?php
|
||||
$disabled = !empty($gitlab->isAdminToken) ? '' : 'disabled';
|
||||
common::printLink('gitlab', 'browseProject', "gitlabID=$id", "<i class='icon icon-project'></i> ", '',"title={$lang->gitlab->browseProject} class='btn btn-primary'");
|
||||
common::printLink('gitlab', 'browseGroup', "gitlabID=$id", "<i class='icon icon-folder-outline'></i> ", '', "title={$lang->gitlab->browseGroup} class='btn btn-primary'");
|
||||
common::printLink('gitlab', 'browseProject', "gitlabID=$id", "<i class='icon icon-list'></i> ", '',"title={$lang->gitlab->browseProject} class='btn btn-primary'");
|
||||
common::printLink('gitlab', 'browseGroup', "gitlabID=$id", "<i class='icon icon-group'></i> ", '', "title={$lang->gitlab->browseGroup} class='btn btn-primary'");
|
||||
common::printLink('gitlab', 'edit', "gitlabID=$id", "<i class='icon icon-edit'></i> ", '',"title={$lang->gitlab->edit} class='btn btn-primary'");
|
||||
common::printLink('gitlab', 'browseUser', "gitlabID=$id", "<i class='icon icon-persons'></i> ", '', "title={$lang->gitlab->browseUser} class='btn {$disabled}' ,'disabled'");
|
||||
common::printLink('gitlab', 'bindUser', "id=$id", "<i class='icon icon-link'></i> ", '', "title={$lang->gitlab->bindUser} class='btn {$disabled}' ,'disabled'");
|
||||
|
||||
Reference in New Issue
Block a user