Organize device inventory by customer and restrict token access to its audience
This commit is contained in:
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user