Chore: Move dashboard models to dashboard pkg (#61458)
* Copy dashboard models to dashboard pkg * Use some models from current pkg instead of models * Adjust api pkg * Adjust pkg services * Fix lint
This commit is contained in:
@@ -117,8 +117,8 @@ func ProvideDashboardPermissions(
|
||||
license models.Licensing, dashboardStore dashboards.Store, service accesscontrol.Service,
|
||||
teamService team.Service, userService user.Service,
|
||||
) (*DashboardPermissionsService, error) {
|
||||
getDashboard := func(ctx context.Context, orgID int64, resourceID string) (*models.Dashboard, error) {
|
||||
query := &models.GetDashboardQuery{Uid: resourceID, OrgId: orgID}
|
||||
getDashboard := func(ctx context.Context, orgID int64, resourceID string) (*dashboards.Dashboard, error) {
|
||||
query := &dashboards.GetDashboardQuery{UID: resourceID, OrgID: orgID}
|
||||
if _, err := dashboardStore.GetDashboard(ctx, query); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -145,12 +145,12 @@ func ProvideDashboardPermissions(
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if dashboard.FolderId > 0 {
|
||||
query := &models.GetDashboardQuery{Id: dashboard.FolderId, OrgId: orgID}
|
||||
if dashboard.FolderID > 0 {
|
||||
query := &dashboards.GetDashboardQuery{ID: dashboard.FolderID, OrgID: orgID}
|
||||
if _, err := dashboardStore.GetDashboard(ctx, query); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return []string{dashboards.ScopeFoldersProvider.GetResourceScopeUID(query.Result.Uid)}, nil
|
||||
return []string{dashboards.ScopeFoldersProvider.GetResourceScopeUID(query.Result.UID)}, nil
|
||||
}
|
||||
return []string{}, nil
|
||||
},
|
||||
@@ -200,7 +200,7 @@ func ProvideFolderPermissions(
|
||||
Resource: "folders",
|
||||
ResourceAttribute: "uid",
|
||||
ResourceValidator: func(ctx context.Context, orgID int64, resourceID string) error {
|
||||
query := &models.GetDashboardQuery{Uid: resourceID, OrgId: orgID}
|
||||
query := &dashboards.GetDashboardQuery{UID: resourceID, OrgID: orgID}
|
||||
if _, err := dashboardStore.GetDashboard(ctx, query); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user