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
|
return nil
|
||||||
},
|
},
|
||||||
InheritedScopesSolver: func(ctx context.Context, orgID int64, resourceID string) ([]string, error) {
|
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)
|
dashboard, err := getDashboard(ctx, orgID, resourceID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
metrics.MFolderIDsServiceCount.WithLabelValues(metrics.AccessControl).Inc()
|
metrics.MFolderIDsServiceCount.WithLabelValues(metrics.AccessControl).Inc()
|
||||||
// nolint:staticcheck
|
// nolint:staticcheck
|
||||||
if dashboard.FolderID > 0 {
|
if dashboard.FolderUID != "" {
|
||||||
query := &dashboards.GetDashboardQuery{ID: dashboard.FolderID, OrgID: orgID}
|
query := &dashboards.GetDashboardQuery{UID: dashboard.FolderUID, OrgID: orgID}
|
||||||
queryResult, err := dashboardStore.GetDashboard(ctx, query)
|
queryResult, err := dashboardStore.GetDashboard(ctx, query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -188,9 +191,12 @@ func ProvideDashboardPermissions(
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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{
|
Assignments: resourcepermissions.Assignments{
|
||||||
Users: true,
|
Users: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user