Chore: Remove Result from dashboard models (#61997)
* Chore: Remove Result from dashboard models * Fix lint tests * Fix dashboard service tests * Fix API tests * Remove commented out code * Chore: Merge main - cleanup
This commit is contained in:
@@ -15,9 +15,9 @@ import (
|
||||
// 1) Permissions for the dashboard
|
||||
// 2) permissions for its parent folder
|
||||
// 3) if no specific permissions have been set for the dashboard or its parent folder then get the default permissions
|
||||
func (d *DashboardStore) GetDashboardACLInfoList(ctx context.Context, query *dashboards.GetDashboardACLInfoListQuery) error {
|
||||
func (d *DashboardStore) GetDashboardACLInfoList(ctx context.Context, query *dashboards.GetDashboardACLInfoListQuery) ([]*dashboards.DashboardACLInfoDTO, error) {
|
||||
queryResult := make([]*dashboards.DashboardACLInfoDTO, 0)
|
||||
outerErr := d.store.WithDbSession(ctx, func(dbSession *db.Session) error {
|
||||
query.Result = make([]*dashboards.DashboardACLInfoDTO, 0)
|
||||
falseStr := d.store.GetDialect().BooleanStr(false)
|
||||
|
||||
if query.DashboardID == 0 {
|
||||
@@ -41,7 +41,7 @@ func (d *DashboardStore) GetDashboardACLInfoList(ctx context.Context, query *das
|
||||
falseStr + ` AS inherited
|
||||
FROM dashboard_acl as da
|
||||
WHERE da.dashboard_id = -1`
|
||||
return dbSession.SQL(sql).Find(&query.Result)
|
||||
return dbSession.SQL(sql).Find(&queryResult)
|
||||
}
|
||||
|
||||
rawSQL := `
|
||||
@@ -83,18 +83,18 @@ func (d *DashboardStore) GetDashboardACLInfoList(ctx context.Context, query *das
|
||||
ORDER BY da.id ASC
|
||||
`
|
||||
|
||||
return dbSession.SQL(rawSQL, query.OrgID, query.DashboardID).Find(&query.Result)
|
||||
return dbSession.SQL(rawSQL, query.OrgID, query.DashboardID).Find(&queryResult)
|
||||
})
|
||||
|
||||
if outerErr != nil {
|
||||
return outerErr
|
||||
return nil, outerErr
|
||||
}
|
||||
|
||||
for _, p := range query.Result {
|
||||
for _, p := range queryResult {
|
||||
p.PermissionName = p.Permission.String()
|
||||
}
|
||||
|
||||
return nil
|
||||
return queryResult, nil
|
||||
}
|
||||
|
||||
// HasEditPermissionInFolders validates that an user have access to a certain folder
|
||||
|
||||
Reference in New Issue
Block a user