RBAC: Check plugins:install globally (#78438)

* RBAC: Check plugins:install globally

* Add disclamer to the RBACSingleOrganization config option
This commit is contained in:
Gabriel MABILLE
2023-11-21 15:09:43 +01:00
committed by GitHub
parent 9e11779921
commit b6b86bb0b3
6 changed files with 38 additions and 13 deletions
+10
View File
@@ -252,6 +252,16 @@ func UseGlobalOrg(c *contextmodel.ReqContext) (int64, error) {
return GlobalOrgID, nil
}
// UseGlobalOrSingleOrg returns the global organization or the current organization in a single organization setup
func UseGlobalOrSingleOrg(cfg *setting.Cfg) OrgIDGetter {
return func(c *contextmodel.ReqContext) (int64, error) {
if cfg.RBACSingleOrganization {
return c.GetOrgID(), nil
}
return GlobalOrgID, nil
}
}
// scopeParams holds the parameters used to fill in scope templates
type scopeParams struct {
OrgID int64
@@ -59,7 +59,7 @@ func DeclareRBACRoles(service ac.Service, cfg *setting.Cfg) error {
Role: ac.RoleDTO{
Name: ac.FixedRolePrefix + "plugins:maintainer",
DisplayName: "Plugin Maintainer",
Description: "Install, uninstall plugins",
Description: "Install, uninstall plugins. Needs to be assigned globally.",
Group: "Plugins",
Permissions: []ac.Permission{
{Action: ActionInstall},