FeatureFlags: Avoid using cfg.IsFeatureToggleEnabled (#81407)

This commit is contained in:
Ryan McKinley
2024-01-28 15:22:45 -08:00
committed by GitHub
parent 1a1531ca5e
commit 1fab107e79
21 changed files with 248 additions and 387 deletions
@@ -30,7 +30,7 @@ func ReqCanAdminPlugins(cfg *setting.Cfg) func(rc *contextmodel.ReqContext) bool
}
}
func DeclareRBACRoles(service ac.Service, cfg *setting.Cfg) error {
func DeclareRBACRoles(service ac.Service, cfg *setting.Cfg, features featuremgmt.FeatureToggles) error {
AppPluginsReader := ac.RoleRegistration{
Role: ac.RoleDTO{
Name: ac.FixedRolePrefix + "plugins.app:reader",
@@ -69,7 +69,7 @@ func DeclareRBACRoles(service ac.Service, cfg *setting.Cfg) error {
}
if !cfg.PluginAdminEnabled ||
(cfg.PluginAdminExternalManageEnabled && !cfg.IsFeatureToggleEnabled(featuremgmt.FlagManagedPluginsInstall)) {
(cfg.PluginAdminExternalManageEnabled && !features.IsEnabledGlobally(featuremgmt.FlagManagedPluginsInstall)) {
PluginsMaintainer.Grants = []string{}
}