style: apply rustfmt after clippy let-chain fixes
This commit is contained in:
1 parent
b25a015898
commit
312c78dbbb
16 files changed
+211
-173
No files matched your search
@@ -222,39 +222,40 @@ pub async fn update(
|
||||
}
|
||||
|
||||
if let Some(new_enabled) = enabled
|
||||
&& new_enabled != existing.enabled {
|
||||
let action = if new_enabled {
|
||||
"application.member_enabled"
|
||||
} else {
|
||||
"application.member_disabled"
|
||||
};
|
||||
&& new_enabled != existing.enabled
|
||||
{
|
||||
let action = if new_enabled {
|
||||
"application.member_enabled"
|
||||
} else {
|
||||
"application.member_disabled"
|
||||
};
|
||||
|
||||
let metadata = serde_json::json!({
|
||||
"application_id": application_id,
|
||||
"user_id": user_id,
|
||||
"role": existing.role,
|
||||
"enabled": new_enabled,
|
||||
})
|
||||
.to_string();
|
||||
let metadata = serde_json::json!({
|
||||
"application_id": application_id,
|
||||
"user_id": user_id,
|
||||
"role": existing.role,
|
||||
"enabled": new_enabled,
|
||||
})
|
||||
.to_string();
|
||||
|
||||
let audit_event = crate::audit::AuditEvent {
|
||||
actor_id: audit_actor_id,
|
||||
target_id: Some(user_id),
|
||||
action,
|
||||
resource_type: "application",
|
||||
resource_id: Some(application_id),
|
||||
severity: crate::db::models::AuditSeverity::Info,
|
||||
ip: audit_ip,
|
||||
ua: audit_ua,
|
||||
metadata: Some(&metadata),
|
||||
};
|
||||
let audit_event = crate::audit::AuditEvent {
|
||||
actor_id: audit_actor_id,
|
||||
target_id: Some(user_id),
|
||||
action,
|
||||
resource_type: "application",
|
||||
resource_id: Some(application_id),
|
||||
severity: crate::db::models::AuditSeverity::Info,
|
||||
ip: audit_ip,
|
||||
ua: audit_ua,
|
||||
metadata: Some(&metadata),
|
||||
};
|
||||
|
||||
provider
|
||||
.application_members()
|
||||
.set_enabled_with_audit(application_id, user_id, new_enabled, Some(audit_event))
|
||||
.await
|
||||
.map_err(AppError::Database)?;
|
||||
}
|
||||
provider
|
||||
.application_members()
|
||||
.set_enabled_with_audit(application_id, user_id, new_enabled, Some(audit_event))
|
||||
.await
|
||||
.map_err(AppError::Database)?;
|
||||
}
|
||||
|
||||
provider
|
||||
.application_members()
|
||||
|
||||
@@ -324,9 +324,10 @@ pub async fn update(
|
||||
.find_by_slug(slug)
|
||||
.await
|
||||
.map_err(AppError::Database)?
|
||||
&& (other.entity_id != id || other.entity_type != "application") {
|
||||
return Err(AppError::Conflict(format!("slug '{slug}' already exists")));
|
||||
}
|
||||
&& (other.entity_id != id || other.entity_type != "application")
|
||||
{
|
||||
return Err(AppError::Conflict(format!("slug '{slug}' already exists")));
|
||||
}
|
||||
|
||||
let redirect_json = redirect_uris.map(|v| serde_json::to_string(&v).unwrap_or_default());
|
||||
let scopes_json = scopes.map(|v| serde_json::to_string(&v).unwrap_or_default());
|
||||
|
||||
@@ -191,9 +191,10 @@ pub async fn update_role(
|
||||
.find_by_name(name)
|
||||
.await
|
||||
.map_err(AppError::Database)?
|
||||
&& other.id != id {
|
||||
return Err(AppError::Conflict(format!("role '{name}' already exists")));
|
||||
}
|
||||
&& other.id != id
|
||||
{
|
||||
return Err(AppError::Conflict(format!("role '{name}' already exists")));
|
||||
}
|
||||
|
||||
provider
|
||||
.roles()
|
||||
|
||||
Reference in new issue
Block a user