mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
RBAC: Handle case when folder id is negative (#53438)
This commit is contained in:
@@ -130,6 +130,10 @@ func NewDashboardUIDScopeResolver(db Store) (string, ac.ScopeAttributeResolver)
|
||||
|
||||
func resolveDashboardScope(ctx context.Context, db Store, orgID int64, dashboard *models.Dashboard) ([]string, error) {
|
||||
var folderUID string
|
||||
if dashboard.FolderId < 0 {
|
||||
return []string{ScopeDashboardsProvider.GetResourceScopeUID(dashboard.Uid)}, nil
|
||||
}
|
||||
|
||||
if dashboard.FolderId == 0 {
|
||||
folderUID = ac.GeneralFolderUID
|
||||
} else {
|
||||
@@ -139,6 +143,7 @@ func resolveDashboardScope(ctx context.Context, db Store, orgID int64, dashboard
|
||||
}
|
||||
folderUID = folder.Uid
|
||||
}
|
||||
|
||||
return []string{
|
||||
ScopeDashboardsProvider.GetResourceScopeUID(dashboard.Uid),
|
||||
ScopeFoldersProvider.GetResourceScopeUID(folderUID),
|
||||
|
||||
Reference in New Issue
Block a user