backport 48171 (#48775)
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
@@ -219,3 +221,7 @@ func extractPrefixes(prefix string) (string, string, bool) {
|
||||
attributePrefix := rootPrefix + parts[1] + ":"
|
||||
return rootPrefix, attributePrefix, true
|
||||
}
|
||||
|
||||
func IsDisabled(cfg *setting.Cfg) bool {
|
||||
return !cfg.IsFeatureToggleEnabled(featuremgmt.FlagAccesscontrol)
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ func (ac *OSSAccessControlService) GetUserBuiltInRoles(user *models.SignedInUser
|
||||
builtInRoles := []string{string(user.OrgRole)}
|
||||
|
||||
// With built-in role simplifying, inheritance is performed upon role registration.
|
||||
if !ac.features.IsEnabled(featuremgmt.FlagAccesscontrolBuiltins) {
|
||||
if ac.IsDisabled() {
|
||||
for _, br := range user.OrgRole.Children() {
|
||||
builtInRoles = append(builtInRoles, string(br))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user