Organize device inventory by customer and restrict token access to its audience

This commit is contained in:
2026-11-17 21:55:24 +01:00
parent aeb9adc649
commit 0afaca1d64
39 changed files with 1950 additions and 225 deletions
+4 -1
View File
@@ -1065,7 +1065,10 @@ pub async fn requester_enabled(
tenant: Uuid,
) -> std::result::Result<bool, sqlx::Error> {
if name.starts_with("mcp:") {
crate::mcp_tokens::enabled_in(tx, name).await
crate::mcp_tokens::issuer_enabled(state, tx, name).await
} else if name.starts_with("local:") {
let Some(home)=state.auth.local.as_ref().and_then(|local|local.home(name)) else {return Ok(false);};
sqlx::query_scalar("SELECT $3=ANY(local_customer_tenants($1,$2))").bind(name).bind(home).bind(tenant).fetch_one(&mut **tx).await
} else {
Ok(state.auth.operator_enabled(name, tenant))
}