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 {
// Check for conflicting group attribute with the same name but different type.
// Done inside the transaction to prevent TOCTOU races.
let schema =
Self::get_schema_with_transaction(transaction).await?;
let schema = Self::get_schema_with_transaction(transaction).await?;
if let Some(group_attr) = schema
.group_attributes
.attributes
.iter()
.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!(
"A group attribute '{}' already exists with type {:?}, \
return Err(DomainError::InternalError(format!(
"A group attribute '{}' already exists with type {:?}, \
cannot create a user attribute with 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 {
attribute_name: Set(request.name),
@@ -73,22 +71,20 @@ impl SchemaBackendHandler for SqlBackendHandler {
Box::pin(async move {
// Check for conflicting user attribute with the same name but different type.
// Done inside the transaction to prevent TOCTOU races.
let schema =
Self::get_schema_with_transaction(transaction).await?;
let schema = Self::get_schema_with_transaction(transaction).await?;
if let Some(user_attr) = schema
.user_attributes
.attributes
.iter()
.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!(
"A user attribute '{}' already exists with type {:?}, \
return Err(DomainError::InternalError(format!(
"A user attribute '{}' already exists with type {:?}, \
cannot create a group attribute with 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 {
attribute_name: Set(request.name),