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:
@@ -48,10 +48,6 @@ func NewResourceServer(ctx context.Context, db infraDB.DB, cfg *setting.Cfg, fea
|
|||||||
opts.Diagnostics = store
|
opts.Diagnostics = store
|
||||||
opts.Lifecycle = store
|
opts.Lifecycle = store
|
||||||
|
|
||||||
if features.IsEnabledGlobally(featuremgmt.FlagUnifiedStorageSearch) {
|
|
||||||
opts.Index = resource.NewResourceIndexServer(cfg, tracer)
|
|
||||||
}
|
|
||||||
|
|
||||||
if features.IsEnabledGlobally(featuremgmt.FlagKubernetesFolders) {
|
if features.IsEnabledGlobally(featuremgmt.FlagKubernetesFolders) {
|
||||||
opts.WriteAccess = resource.WriteAccessHooks{
|
opts.WriteAccess = resource.WriteAccessHooks{
|
||||||
Folder: func(ctx context.Context, user claims.AuthInfo, uid string) bool {
|
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)
|
rs, err := resource.NewResourceServer(opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user