RBAC: Fix folder move check when action sets are disabled (#91200)

fox folder move check when action sets are disabled
This commit is contained in:
Ieva 2024-07-31 09:49:09 +01:00 committed by GitHub
parent 44f5db5609
commit 702fc3477d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -978,6 +978,12 @@ func (s *Service) canMove(ctx context.Context, cmd *folder.MoveFolderCommand) (b
var evaluators []accesscontrol.Evaluator
currentFolderScope := dashboards.ScopeFoldersProvider.GetResourceScopeUID(cmd.UID)
for action, scopes := range permissions {
// Skip unexpanded action sets - they have no impact if action sets are not enabled
if !s.features.IsEnabled(ctx, featuremgmt.FlagAccessActionSets) {
if action == "folders:view" || action == "folders:edit" || action == "folders:admin" {
continue
}
}
for _, scope := range newFolderAndParentUIDs {
if slices.Contains(scopes, scope) {
evaluators = append(evaluators, accesscontrol.EvalPermission(action, currentFolderScope))