Unified Storage /Folders: Allow Unified Storage subfolders creation (#94327)

* Add parents field to folder DTO
* Allow subfolder creation when folder flag is enabled
* Update UnstructuredToLegacyFolder
* Include parents field when creating folder
This commit is contained in:
Arati R.
2024-10-07 16:48:56 +02:00
committed by GitHub
parent 0d67b5a6e9
commit ea5cf7c51f
3 changed files with 125 additions and 34 deletions

View File

@@ -1,6 +1,9 @@
package sql
import (
"context"
"github.com/grafana/authlib/claims"
infraDB "github.com/grafana/grafana/pkg/infra/db"
"github.com/grafana/grafana/pkg/infra/tracing"
"github.com/grafana/grafana/pkg/services/featuremgmt"
@@ -31,5 +34,16 @@ func NewResourceServer(db infraDB.DB, cfg *setting.Cfg, features featuremgmt.Fea
opts.Index = resource.NewResourceIndexServer()
}
if features.IsEnabledGlobally(featuremgmt.FlagKubernetesFolders) {
opts.WriteAccess = resource.WriteAccessHooks{
Folder: func(ctx context.Context, user claims.AuthInfo, uid string) bool {
// #TODO build on the logic here
// #TODO only enable write access when the resource being written in the folder
// is another folder
return true
},
}
}
return resource.NewResourceServer(opts)
}