chore: fmt and clippy

This commit is contained in:
Valentin Tolmer
2026-05-26 23:31:47 +02:00
committed by nitnelave
parent 203169fe4a
commit d293941a44

View File

@@ -34,22 +34,20 @@ impl SchemaBackendHandler for SqlBackendHandler {
Box::pin(async move { Box::pin(async move {
// Check for conflicting group attribute with the same name but different type. // Check for conflicting group attribute with the same name but different type.
// Done inside the transaction to prevent TOCTOU races. // Done inside the transaction to prevent TOCTOU races.
let schema = let schema = Self::get_schema_with_transaction(transaction).await?;
Self::get_schema_with_transaction(transaction).await?;
if let Some(group_attr) = schema if let Some(group_attr) = schema
.group_attributes .group_attributes
.attributes .attributes
.iter() .iter()
.find(|a| a.name == request.name) .find(|a| a.name == request.name)
&& group_attr.attribute_type != request.attribute_type
{ {
if group_attr.attribute_type != request.attribute_type { return Err(DomainError::InternalError(format!(
return Err(DomainError::InternalError(format!( "A group attribute '{}' already exists with type {:?}, \
"A group attribute '{}' already exists with type {:?}, \
cannot create a user attribute with type {:?}. \ cannot create a user attribute with type {:?}. \
LDAP requires each attribute name to have a single type.", LDAP requires each attribute name to have a single type.",
request.name, group_attr.attribute_type, request.attribute_type request.name, group_attr.attribute_type, request.attribute_type
))); )));
}
} }
let new_attribute = model::user_attribute_schema::ActiveModel { let new_attribute = model::user_attribute_schema::ActiveModel {
attribute_name: Set(request.name), attribute_name: Set(request.name),
@@ -73,22 +71,20 @@ impl SchemaBackendHandler for SqlBackendHandler {
Box::pin(async move { Box::pin(async move {
// Check for conflicting user attribute with the same name but different type. // Check for conflicting user attribute with the same name but different type.
// Done inside the transaction to prevent TOCTOU races. // Done inside the transaction to prevent TOCTOU races.
let schema = let schema = Self::get_schema_with_transaction(transaction).await?;
Self::get_schema_with_transaction(transaction).await?;
if let Some(user_attr) = schema if let Some(user_attr) = schema
.user_attributes .user_attributes
.attributes .attributes
.iter() .iter()
.find(|a| a.name == request.name) .find(|a| a.name == request.name)
&& user_attr.attribute_type != request.attribute_type
{ {
if user_attr.attribute_type != request.attribute_type { return Err(DomainError::InternalError(format!(
return Err(DomainError::InternalError(format!( "A user attribute '{}' already exists with type {:?}, \
"A user attribute '{}' already exists with type {:?}, \
cannot create a group attribute with type {:?}. \ cannot create a group attribute with type {:?}. \
LDAP requires each attribute name to have a single type.", LDAP requires each attribute name to have a single type.",
request.name, user_attr.attribute_type, request.attribute_type request.name, user_attr.attribute_type, request.attribute_type
))); )));
}
} }
let new_attribute = model::group_attribute_schema::ActiveModel { let new_attribute = model::group_attribute_schema::ActiveModel {
attribute_name: Set(request.name), attribute_name: Set(request.name),