K8s/Folders: Add write access hook before creating index server (#96030)

Change order of when to add write access hook
This commit is contained in:
Arati R. 2024-11-07 15:20:07 +01:00 committed by GitHub
parent 1e58747a39
commit 7fa4a979e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,10 +48,6 @@ func NewResourceServer(ctx context.Context, db infraDB.DB, cfg *setting.Cfg, fea
opts.Diagnostics = store
opts.Lifecycle = store
if features.IsEnabledGlobally(featuremgmt.FlagUnifiedStorageSearch) {
opts.Index = resource.NewResourceIndexServer(cfg, tracer)
}
if features.IsEnabledGlobally(featuremgmt.FlagKubernetesFolders) {
opts.WriteAccess = resource.WriteAccessHooks{
Folder: func(ctx context.Context, user claims.AuthInfo, uid string) bool {
@ -63,6 +59,10 @@ func NewResourceServer(ctx context.Context, db infraDB.DB, cfg *setting.Cfg, fea
}
}
if features.IsEnabledGlobally(featuremgmt.FlagUnifiedStorageSearch) {
opts.Index = resource.NewResourceIndexServer(cfg, tracer)
}
rs, err := resource.NewResourceServer(opts)
if err != nil {
return nil, err