From 6b90ec50d053a17b88ee647e1a9c7bbf8d5d8e6e Mon Sep 17 00:00:00 2001 From: zhaoke Date: Mon, 11 Sep 2023 16:35:08 +0800 Subject: [PATCH] * Adjust priv of devops. --- module/gitea/control.php | 3 ++- module/gitlab/control.php | 5 +++++ module/gogs/control.php | 2 +- module/sonarqube/control.php | 5 +++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/module/gitea/control.php b/module/gitea/control.php index 2af20f9237..d95e35ab6d 100644 --- a/module/gitea/control.php +++ b/module/gitea/control.php @@ -20,7 +20,8 @@ class gitea extends control { parent::__construct($moduleName, $methodName); - if(!commonModel::hasPriv('space', 'browse')) $this->loadModel('common')->deny('space', 'browse', false); + if(!commonModel::hasPriv('instance', 'manage')) $this->loadModel('common')->deny('instance', 'manage', false); + /* This is essential when changing tab(menu) from gitea to repo. */ /* Optional: common::setMenuVars('devops', $this->session->repoID); */ if($this->app->rawMethod != 'binduser') $this->loadModel('ci')->setMenu(); diff --git a/module/gitlab/control.php b/module/gitlab/control.php index de9139a8d8..6afa971190 100644 --- a/module/gitlab/control.php +++ b/module/gitlab/control.php @@ -21,6 +21,11 @@ class gitlab extends control parent::__construct($moduleName, $methodName); if(!commonModel::hasPriv('space', 'browse')) $this->loadModel('common')->deny('space', 'browse', false); + + if(!in_array($methodName, array('browseproject', 'browsegroup', 'managegroupmembers', 'browseuser', 'browsebranch', 'manageprojectmembers', 'managebranchpriv', 'managetagpriv', 'browsetag'))) + { + if(!commonModel::hasPriv('instance', 'manage')) $this->loadModel('common')->deny('instance', 'manage', false); + } /* This is essential when changing tab(menu) from gitlab to repo. */ /* Optional: common::setMenuVars('devops', $this->session->repoID); */ $this->loadModel('ci')->setMenu(); diff --git a/module/gogs/control.php b/module/gogs/control.php index 0779c7fd1b..243bf57af4 100644 --- a/module/gogs/control.php +++ b/module/gogs/control.php @@ -20,7 +20,7 @@ class gogs extends control { parent::__construct($moduleName, $methodName); - if(!commonModel::hasPriv('space', 'browse')) $this->loadModel('common')->deny('space', 'browse', false); + if(!commonModel::hasPriv('instance', 'manage')) $this->loadModel('common')->deny('instance', 'manage', false); /* This is essential when changing tab(menu) from gogs to repo. */ /* Optional: common::setMenuVars('devops', $this->session->repoID); */ if($this->app->rawMethod != 'binduser') $this->loadModel('ci')->setMenu(); diff --git a/module/sonarqube/control.php b/module/sonarqube/control.php index 574e8184cb..927262b42e 100644 --- a/module/sonarqube/control.php +++ b/module/sonarqube/control.php @@ -21,6 +21,11 @@ class sonarqube extends control parent::__construct($moduleName, $methodName); if(!commonModel::hasPriv('space', 'browse')) $this->loadModel('common')->deny('space', 'browse', false); + + if(!in_array($methodName, array('browseproject', 'reportview', 'browseissue'))) + { + if(!commonModel::hasPriv('instance', 'manage')) $this->loadModel('common')->deny('instance', 'manage', false); + } /* This is essential when changing tab(menu) from gitlab to repo. */ /* Optional: common::setMenuVars('devops', $this->session->repoID); */ $this->loadModel('ci')->setMenu();