collections fix

This commit is contained in:
dal 2025-04-01 14:05:22 -06:00
parent 5e3f67eb7d
commit 4c30dc3cca
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
2 changed files with 15 additions and 3 deletions

View File

@ -162,7 +162,12 @@ pub async fn add_assets_to_collection_handler(
// Check if user has access to the dashboard
let has_dashboard_permission = check_permission_access(
dashboard.permission,
&[AssetPermissionRole::CanView],
&[
AssetPermissionRole::CanView,
AssetPermissionRole::CanEdit,
AssetPermissionRole::FullAccess,
AssetPermissionRole::Owner,
],
dashboard.dashboard_file.organization_id,
&user.organizations,
);
@ -314,7 +319,12 @@ pub async fn add_assets_to_collection_handler(
// Check if user has access to the metric
let has_metric_permission = check_permission_access(
metric.permission,
&[AssetPermissionRole::CanView],
&[
AssetPermissionRole::CanView,
AssetPermissionRole::CanEdit,
AssetPermissionRole::FullAccess,
AssetPermissionRole::Owner,
],
metric.metric_file.organization_id,
&user.organizations,
);

View File

@ -27,7 +27,7 @@ struct AssetPermissionInfo {
}
/// Type for querying asset data from database
#[derive(Queryable, Clone)]
#[derive(Queryable, Clone, Debug)]
struct AssetQueryResult {
id: Uuid,
name: String,
@ -222,6 +222,8 @@ pub async fn get_collection_handler(
}
};
println!("dashboard_assets: {:?}", dashboard_assets);
// Combine all assets
let all_assets = [metric_assets, dashboard_assets].concat();
let formatted_assets = format_assets(all_assets);