26 lines
597 B
Rust
26 lines
597 B
Rust
use std::collections::HashMap;
|
|
|
|
use db::permissions::PermissionRaw;
|
|
|
|
use crate::prelude::*;
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
pub struct Params {
|
|
folder_id: Uuid,
|
|
}
|
|
|
|
pub async fn get(
|
|
State(pool): State<Pool>,
|
|
Query(params): Query<Params>,
|
|
claims: Claims,
|
|
) -> GeneralResult<Json<HashMap<i32, PermissionRaw>>> {
|
|
db::folder::get_permissions(params.folder_id, claims.user_id, &pool)
|
|
.await
|
|
.can_read_guard()?;
|
|
|
|
db::permissions::get_all_for_folder(params.folder_id, &pool)
|
|
.await
|
|
.handle_internal("Error getting permissions")
|
|
.map(Json)
|
|
}
|