* Modify gitlab group access.
This commit is contained in:
@@ -314,15 +314,15 @@ 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, 'owner');
|
||||
|
||||
$adminGropuIDList = array();
|
||||
foreach($adminGroups as $group) $adminGropuIDList[] = $group->id;
|
||||
$adminGroupIDList = array();
|
||||
foreach($adminGroups as $group) $adminGroupIDList[] = $group->id;
|
||||
|
||||
$this->view->title = $this->lang->gitlab->common . $this->lang->colon . $this->lang->gitlab->browseGroup;
|
||||
$this->view->gitlabID = $gitlabID;
|
||||
$this->view->gitlabGroupList = $groups;
|
||||
$this->view->adminGropuIDList = $adminGropuIDList;
|
||||
$this->view->adminGroupIDList = $adminGroupIDList;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->display();
|
||||
}
|
||||
@@ -656,7 +656,7 @@ class gitlab extends control
|
||||
|
||||
/* Get group id list by gitlab user that the user is maintainer. */
|
||||
$groupIDList = array(0 => 0);
|
||||
$groups = $this->gitlab->apiGetGroups($gitlabID, 'name_asc', $this->config->gitlab->accessLevel['maintainer']);
|
||||
$groups = $this->gitlab->apiGetGroups($gitlabID, 'name_asc', 'maintainer');
|
||||
foreach($groups as $group) $groupIDList[] = $group->id;
|
||||
|
||||
foreach($result['projects'] as $key => $project)
|
||||
|
||||
+10
-3
@@ -592,11 +592,18 @@ class gitlabModel extends model
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function apiGetGroups($gitlabID, $orderBy, $minAccessLevel = 0)
|
||||
public function apiGetGroups($gitlabID, $orderBy, $minRole = '')
|
||||
{
|
||||
$apiRoot = $this->getApiRoot($gitlabID);
|
||||
$url = sprintf($apiRoot, "/groups");
|
||||
if($minAccessLevel > 0) $url .= "&min_access_level=$minAccessLevel";
|
||||
if($minRole == 'owner')
|
||||
{
|
||||
$url .= '&owned=true';
|
||||
}
|
||||
elseif(!empty($minRole))
|
||||
{
|
||||
$url .= "&min_access_level=$this->config->gitlab->accessLevel[$minRole]";
|
||||
}
|
||||
|
||||
list($order, $sort) = explode('_', $orderBy);
|
||||
|
||||
@@ -2777,7 +2784,7 @@ class gitlabModel extends model
|
||||
{
|
||||
if(empty($groupIDList))
|
||||
{
|
||||
$groups = $this->apiGetGroups($gitlabID, 'name_asc', $accessLevel);
|
||||
$groups = $this->apiGetGroups($gitlabID, 'name_asc', $maxRole);
|
||||
foreach($groups as $group) $groupIDList[] = $group->id;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 = ($app->user->admin or in_array($gitlabGroup->id, $adminGropuIDList)) ? '' : 'disabled';
|
||||
$adminClass = ($app->user->admin or in_array($gitlabGroup->id, $adminGroupIDList)) ? '' : '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}'");
|
||||
|
||||
Reference in New Issue
Block a user