mirror of
https://github.com/grafana/grafana.git
synced 2024-11-27 03:11:01 -06:00
RBAC: Handle case when folder id is negative (#53438)
This commit is contained in:
parent
59ce564d49
commit
592d31e617
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user