From b2df908f523986a0580eb0ec4fb406dd400f7232 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Thu, 24 Aug 2023 09:49:01 +0800 Subject: [PATCH] * Change gitlab branch and tag access check. --- module/gitlab/control.php | 1 + module/gitlab/view/browseproject.html.php | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/module/gitlab/control.php b/module/gitlab/control.php index 8a1e5c2985..8fc60b0b9d 100644 --- a/module/gitlab/control.php +++ b/module/gitlab/control.php @@ -727,6 +727,7 @@ class gitlab extends control if(!$project->adminer and isset($project->owner) and $project->owner->id == $openID) $project->adminer = true; $project->isMaintainer = $this->gitlab->checkUserAccess($gitlabID, $project->id, $project, $groupIDList, 'maintainer'); + $project->isDeveloper = $this->gitlab->checkUserAccess($gitlabID, $project->id, $project, $groupIDList, 'developer'); } $gitlab = $this->gitlab->getByID($gitlabID); diff --git a/module/gitlab/view/browseproject.html.php b/module/gitlab/view/browseproject.html.php index 9c6cb05416..fdf98917b2 100644 --- a/module/gitlab/view/browseproject.html.php +++ b/module/gitlab/view/browseproject.html.php @@ -64,8 +64,9 @@ $adminerClass = $gitlabProject->adminer ? '' : 'disabled'; $maintainerClass = $gitlabProject->isMaintainer ? '' : 'disabled'; $defaultBranchClass = $gitlabProject->adminer ? '' : 'disabled'; - echo common::printIcon('gitlab', 'browseBranch', "gitlabID=$gitlabID&projectID=$gitlabProject->id", '', 'list', 'treemap', '', $defaultBranchClass, false, '', $this->lang->gitlab->browseBranch); - echo common::printIcon('gitlab', 'browseTag', "gitlabID=$gitlabID&projectID=$gitlabProject->id", '', 'list', 'tag', '', $defaultBranchClass, false, '', $this->lang->gitlab->browseTag); + $developerClass = $gitlabProject->isDeveloper ? '' : 'disabled'; + echo common::printIcon('gitlab', 'browseBranch', "gitlabID=$gitlabID&projectID=$gitlabProject->id", '', 'list', 'treemap', '', $developerClass, false, '', $this->lang->gitlab->browseBranch); + echo common::printIcon('gitlab', 'browseTag', "gitlabID=$gitlabID&projectID=$gitlabProject->id", '', 'list', 'tag', '', $developerClass, false, '', $this->lang->gitlab->browseTag); echo common::printIcon('gitlab', 'manageBranchPriv', "gitlabID=$gitlabID&projectID=$gitlabProject->id", '', 'list', 'branch-lock', '', $defaultBranchClass . ' ' . $maintainerClass, false, '', $this->lang->gitlab->browseBranchPriv); echo common::printIcon('gitlab', 'manageTagPriv', "gitlabID=$gitlabID&projectID=$gitlabProject->id", '', 'list', 'tag-lock', '', $defaultBranchClass . ' ' . $maintainerClass, false, '', $this->lang->gitlab->browseTagPriv); echo common::printIcon('gitlab', 'manageProjectMembers', 'repoID=' . zget($repoPairs, $gitlabProject->id), '', 'list', 'team', '', $hasRepoClass);