chore : Deprecating FeatureToggles.IsEnabledGlobally (#112885)
* add deprecation on featuremgmt.IsEnabledGlobally * add nolint reason * add reasonable deprecation message * remove junk edits * add more nolints * addressing review comments * Update pkg/services/featuremgmt/models.go Co-authored-by: Dave Henderson <dave.henderson@grafana.com> --------- Co-authored-by: Dave Henderson <dave.henderson@grafana.com>
This commit is contained in:
co-authored by
Dave Henderson
parent
4cea71ee73
commit
81683d554d
@@ -58,6 +58,7 @@ func ProvideRegistration(
|
||||
var passwordClients []authn.PasswordClient
|
||||
|
||||
// always register LDAP if LDAP is enabled in SSO settings
|
||||
//nolint:staticcheck // not yet migrated to OpenFeature
|
||||
if cfg.LDAPAuthEnabled || features.IsEnabledGlobally(featuremgmt.FlagSsoSettingsLDAP) {
|
||||
ldap := clients.ProvideLDAP(cfg, ldapService, userService, authInfoService, tracer)
|
||||
proxyClients = append(proxyClients, ldap)
|
||||
@@ -125,6 +126,7 @@ func ProvideRegistration(
|
||||
authnSvc.RegisterClient(clients.ProvideOAuth(clientName, cfg, oauthTokenService, socialService, settingsProviderService, features, tracer))
|
||||
}
|
||||
|
||||
//nolint:staticcheck // not yet migrated to OpenFeature
|
||||
if features.IsEnabledGlobally(featuremgmt.FlagProvisioning) {
|
||||
authnSvc.RegisterClient(clients.ProvideProvisioning())
|
||||
}
|
||||
@@ -140,11 +142,13 @@ func ProvideRegistration(
|
||||
authnSvc.RegisterPostAuthHook(sync.ProvideOAuthTokenSync(oauthTokenService, sessionService, socialService, tracer, features).SyncOauthTokenHook, 60)
|
||||
authnSvc.RegisterPostAuthHook(userSync.FetchSyncedUserHook, 100)
|
||||
|
||||
//nolint:staticcheck // not yet migrated to OpenFeature
|
||||
if features.IsEnabledGlobally(featuremgmt.FlagEnableSCIM) {
|
||||
authnSvc.RegisterPostAuthHook(userSync.ValidateUserProvisioningHook, 30)
|
||||
}
|
||||
|
||||
rbacSync := sync.ProvideRBACSync(accessControlService, tracer, permRegistry)
|
||||
//nolint:staticcheck // not yet migrated to OpenFeature
|
||||
if features.IsEnabledGlobally(featuremgmt.FlagCloudRBACRoles) {
|
||||
authnSvc.RegisterPostAuthHook(rbacSync.SyncCloudRoles, 110)
|
||||
authnSvc.RegisterPreLogoutHook(gcomsso.ProvideGComSSOService(cfg).LogoutHook, 50)
|
||||
|
||||
@@ -78,6 +78,7 @@ func (s *OAuthTokenSync) SyncOauthTokenHook(ctx context.Context, id *authn.Ident
|
||||
ctxLogger := s.log.FromContext(ctx).New("userID", userID)
|
||||
|
||||
cacheKey := fmt.Sprintf("token-check-%s", id.GetID())
|
||||
//nolint:staticcheck // not yet migrated to OpenFeature
|
||||
if s.features.IsEnabledGlobally(featuremgmt.FlagImprovedExternalSessionHandling) {
|
||||
cacheKey = fmt.Sprintf("token-check-%s-%d", id.GetID(), id.SessionToken.Id)
|
||||
}
|
||||
|
||||
@@ -438,6 +438,7 @@ func (s *UserSync) upsertAuthConnection(ctx context.Context, userID int64, ident
|
||||
AuthId: identity.AuthID,
|
||||
}
|
||||
|
||||
//nolint:staticcheck // not yet migrated to OpenFeature
|
||||
if !s.features.IsEnabledGlobally(featuremgmt.FlagImprovedExternalSessionHandling) {
|
||||
setAuthInfoCmd.OAuthToken = identity.OAuthToken
|
||||
}
|
||||
@@ -450,6 +451,7 @@ func (s *UserSync) upsertAuthConnection(ctx context.Context, userID int64, ident
|
||||
AuthModule: identity.AuthenticatedBy,
|
||||
}
|
||||
|
||||
//nolint:staticcheck // not yet migrated to OpenFeature
|
||||
if !s.features.IsEnabledGlobally(featuremgmt.FlagImprovedExternalSessionHandling) {
|
||||
updateAuthInfoCmd.OAuthToken = identity.OAuthToken
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user