drawbridge_server/users/
head.rs1use super::super::{OidcClaims, ScopeContext, ScopeLevel, Store};
5
6use drawbridge_type::UserContext;
7
8use async_std::sync::Arc;
9use axum::response::IntoResponse;
10use axum::Extension;
11use tracing::{debug, trace};
12
13pub async fn head(
14 Extension(store): Extension<Arc<Store>>,
15 claims: OidcClaims,
16 cx: UserContext,
17) -> impl IntoResponse {
18 trace!(target: "app::users::head", "called for `{cx}`");
19
20 claims
21 .assert_user(&store, &cx, ScopeContext::User, ScopeLevel::Read)
22 .await
23 .map_err(IntoResponse::into_response)?
24 .get_meta()
25 .await
26 .map_err(|e| {
27 debug!(target: "app::users::head", "failed for `{cx}`: {:?}", e);
28 e.into_response()
29 })
30 .map(|meta| (meta, ()))
31}