mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboards: Correctly display Admin access to dashboards in the UI (#88439)
* include folder wildcard scope in dash permission inheritance * Update pkg/services/accesscontrol/ossaccesscontrol/permissions_services.go Co-authored-by: Karl Persson <kalle.persson@grafana.com> --------- Co-authored-by: Karl Persson <kalle.persson@grafana.com>
This commit is contained in:
parent
990ad860df
commit
1c2ae2c72d
@ -170,14 +170,17 @@ func ProvideDashboardPermissions(
|
||||
return nil
|
||||
},
|
||||
InheritedScopesSolver: func(ctx context.Context, orgID int64, resourceID string) ([]string, error) {
|
||||
wildcards := accesscontrol.WildcardsFromPrefix(dashboards.ScopeFoldersPrefix)
|
||||
scopes := []string(wildcards)
|
||||
|
||||
dashboard, err := getDashboard(ctx, orgID, resourceID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
metrics.MFolderIDsServiceCount.WithLabelValues(metrics.AccessControl).Inc()
|
||||
// nolint:staticcheck
|
||||
if dashboard.FolderID > 0 {
|
||||
query := &dashboards.GetDashboardQuery{ID: dashboard.FolderID, OrgID: orgID}
|
||||
if dashboard.FolderUID != "" {
|
||||
query := &dashboards.GetDashboardQuery{UID: dashboard.FolderUID, OrgID: orgID}
|
||||
queryResult, err := dashboardStore.GetDashboard(ctx, query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -188,9 +191,12 @@ func ProvideDashboardPermissions(
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return append([]string{parentScope}, nestedScopes...), nil
|
||||
|
||||
scopes = append(scopes, parentScope)
|
||||
scopes = append(scopes, nestedScopes...)
|
||||
return scopes, nil
|
||||
}
|
||||
return []string{dashboards.ScopeFoldersProvider.GetResourceScopeUID(folder.GeneralFolderUID)}, nil
|
||||
return append(scopes, dashboards.ScopeFoldersProvider.GetResourceScopeUID(folder.GeneralFolderUID)), nil
|
||||
},
|
||||
Assignments: resourcepermissions.Assignments{
|
||||
Users: true,
|
||||
|
Loading…
Reference in New Issue
Block a user