mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Access control: further reduce access control feature toggle checks (#48171)
* reduce the usage of access control flag further by removing it from SQL store methods * fixing tests * fix another test * linting * remove AC feature toggle use from API keys * remove unneeded function
This commit is contained in:
@@ -7,6 +7,8 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/registry"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
@@ -222,3 +224,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)
|
||||
}
|
||||
|
||||
@@ -155,7 +155,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