Merge log lines
This commit is contained in:
parent
b60cb0104b
commit
ffb1637183
1 changed files with 7 additions and 4 deletions
|
|
@ -47,19 +47,22 @@ pub fn auth(state: &AppState, token: &str, vault_id: &VaultId) -> Result<User, S
|
||||||
.cloned()
|
.cloned()
|
||||||
.ok_or_else(|| unauthenticated_error(anyhow::anyhow!("Invalid token")))?;
|
.ok_or_else(|| unauthenticated_error(anyhow::anyhow!("Invalid token")))?;
|
||||||
|
|
||||||
info!("User `{}` authenticated", user.name);
|
|
||||||
|
|
||||||
if match user.vault_access {
|
if match user.vault_access {
|
||||||
VaultAccess::AllowAccessToAll => true,
|
VaultAccess::AllowAccessToAll => true,
|
||||||
VaultAccess::AllowList(AllowListedVaults { ref allowed }) => allowed.contains(vault_id),
|
VaultAccess::AllowList(AllowListedVaults { ref allowed }) => allowed.contains(vault_id),
|
||||||
} {
|
} {
|
||||||
info!(
|
info!(
|
||||||
"User `{}` is authorised to access to vault `{}`",
|
"User '{}' is authenticated and is authorised to access to vault '{vault_id}'",
|
||||||
user.name, vault_id
|
user.name
|
||||||
);
|
);
|
||||||
|
|
||||||
Ok(user)
|
Ok(user)
|
||||||
} else {
|
} else {
|
||||||
|
info!(
|
||||||
|
"User '{}' is authenticated but is not authorised to access vault '{vault_id}'",
|
||||||
|
user.name
|
||||||
|
);
|
||||||
|
|
||||||
Err(permission_denied_error(anyhow::anyhow!(
|
Err(permission_denied_error(anyhow::anyhow!(
|
||||||
"Permission denied for vault `{vault_id}`"
|
"Permission denied for vault `{vault_id}`"
|
||||||
)))
|
)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue