mirror of
https://github.com/lldap/lldap.git
synced 2026-03-31 15:07:48 +01:00
domain: rename AttributeValue to Attribute
Preparation for storing the actual types for each value, which will repurpose the AttributeValue name.
This commit is contained in:
committed by
nitnelave
parent
4c6cfeee9e
commit
8285e21ebb
@@ -10,9 +10,7 @@ use crate::domain::{
|
||||
model::UserColumn,
|
||||
schema::{PublicSchema, SchemaAttributeExtractor},
|
||||
};
|
||||
use lldap_domain::types::{
|
||||
AttributeName, AttributeType, AttributeValue, GroupName, JpegPhoto, UserId,
|
||||
};
|
||||
use lldap_domain::types::{Attribute, AttributeName, AttributeType, GroupName, JpegPhoto, UserId};
|
||||
|
||||
impl From<LdapSubstringFilter> for SubStringFilter {
|
||||
fn from(
|
||||
@@ -287,7 +285,7 @@ pub struct LdapInfo {
|
||||
}
|
||||
|
||||
pub fn get_custom_attribute<Extractor: SchemaAttributeExtractor>(
|
||||
attributes: &[AttributeValue],
|
||||
attributes: &[Attribute],
|
||||
attribute_name: &AttributeName,
|
||||
schema: &PublicSchema,
|
||||
) -> Option<Vec<Vec<u8>>> {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use lldap_domain::types::{AttributeName, AttributeValue, GroupId, Serialized};
|
||||
use lldap_domain::types::{Attribute, AttributeName, GroupId, Serialized};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "group_attributes")]
|
||||
@@ -56,7 +56,7 @@ impl Related<super::GroupAttributeSchema> for Entity {
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
|
||||
impl From<Model> for AttributeValue {
|
||||
impl From<Model> for Attribute {
|
||||
fn from(
|
||||
Model {
|
||||
group_id: _,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use lldap_domain::types::{AttributeName, AttributeValue, Serialized, UserId};
|
||||
use lldap_domain::types::{Attribute, AttributeName, Serialized, UserId};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "user_attributes")]
|
||||
@@ -56,7 +56,7 @@ impl Related<super::UserAttributeSchema> for Entity {
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
|
||||
impl From<Model> for AttributeValue {
|
||||
impl From<Model> for Attribute {
|
||||
fn from(
|
||||
Model {
|
||||
user_id: _,
|
||||
|
||||
@@ -33,7 +33,7 @@ pub mod tests {
|
||||
use lldap_auth::{opaque, registration};
|
||||
use lldap_domain::{
|
||||
requests::{CreateGroupRequest, CreateUserRequest},
|
||||
types::{AttributeValue as DomainAttributeValue, GroupId, Serialized, UserId},
|
||||
types::{Attribute as DomainAttribute, GroupId, Serialized, UserId},
|
||||
};
|
||||
use pretty_assertions::assert_eq;
|
||||
use sea_orm::Database;
|
||||
@@ -93,11 +93,11 @@ pub mod tests {
|
||||
email: format!("{}@bob.bob", name).into(),
|
||||
display_name: Some("display ".to_string() + name),
|
||||
attributes: vec![
|
||||
DomainAttributeValue {
|
||||
DomainAttribute {
|
||||
name: "first_name".into(),
|
||||
value: Serialized::from(("first ".to_string() + name).as_str()),
|
||||
},
|
||||
DomainAttributeValue {
|
||||
DomainAttribute {
|
||||
name: "last_name".into(),
|
||||
value: Serialized::from(("last ".to_string() + name).as_str()),
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::domain::{
|
||||
use async_trait::async_trait;
|
||||
use lldap_domain::{
|
||||
requests::{CreateGroupRequest, UpdateGroupRequest},
|
||||
types::{AttributeName, AttributeValue, Group, GroupDetails, GroupId, Serialized, Uuid},
|
||||
types::{Attribute, AttributeName, Group, GroupDetails, GroupId, Serialized, Uuid},
|
||||
};
|
||||
use sea_orm::{
|
||||
sea_query::{Alias, Cond, Expr, Func, IntoCondition, OnConflict, SimpleExpr},
|
||||
@@ -133,7 +133,7 @@ impl GroupListerBackendHandler for SqlBackendHandler {
|
||||
for group in groups.iter_mut() {
|
||||
group.attributes = attributes_iter
|
||||
.take_while_ref(|u| u.group_id == group.id)
|
||||
.map(AttributeValue::from)
|
||||
.map(Attribute::from)
|
||||
.collect();
|
||||
}
|
||||
groups.sort_by(|g1, g2| g1.display_name.cmp(&g2.display_name));
|
||||
@@ -155,7 +155,7 @@ impl GroupBackendHandler for SqlBackendHandler {
|
||||
.order_by_asc(model::GroupAttributesColumn::AttributeName)
|
||||
.all(&self.sql_pool)
|
||||
.await?;
|
||||
group_details.attributes = attributes.into_iter().map(AttributeValue::from).collect();
|
||||
group_details.attributes = attributes.into_iter().map(Attribute::from).collect();
|
||||
Ok(group_details)
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ mod tests {
|
||||
group_id: fixture.groups[0],
|
||||
display_name: None,
|
||||
delete_attributes: Vec::new(),
|
||||
insert_attributes: vec![AttributeValue {
|
||||
insert_attributes: vec![Attribute {
|
||||
name: "gid".into(),
|
||||
value: Serialized::from(&512),
|
||||
}],
|
||||
@@ -548,7 +548,7 @@ mod tests {
|
||||
.handler
|
||||
.create_group(CreateGroupRequest {
|
||||
display_name: "New Group".into(),
|
||||
attributes: vec![AttributeValue {
|
||||
attributes: vec![Attribute {
|
||||
name: "new_attribute".into(),
|
||||
value: Serialized::from("value"),
|
||||
}],
|
||||
@@ -563,7 +563,7 @@ mod tests {
|
||||
assert_eq!(group_details.display_name, "New Group".into());
|
||||
assert_eq!(
|
||||
group_details.attributes,
|
||||
vec![AttributeValue {
|
||||
vec![Attribute {
|
||||
name: "new_attribute".into(),
|
||||
value: Serialized::from("value"),
|
||||
}]
|
||||
@@ -585,7 +585,7 @@ mod tests {
|
||||
.await
|
||||
.unwrap();
|
||||
let group_id = fixture.groups[0];
|
||||
let attributes = vec![AttributeValue {
|
||||
let attributes = vec![Attribute {
|
||||
name: "new_attribute".into(),
|
||||
value: Serialized::from(&42i64),
|
||||
}];
|
||||
|
||||
@@ -181,7 +181,7 @@ mod tests {
|
||||
};
|
||||
use lldap_domain::requests::UpdateUserRequest;
|
||||
use lldap_domain::schema::AttributeList;
|
||||
use lldap_domain::types::{AttributeType, AttributeValue, Serialized};
|
||||
use lldap_domain::types::{Attribute, AttributeType, Serialized};
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[tokio::test]
|
||||
@@ -296,7 +296,7 @@ mod tests {
|
||||
.handler
|
||||
.update_user(UpdateUserRequest {
|
||||
user_id: "bob".into(),
|
||||
insert_attributes: vec![AttributeValue {
|
||||
insert_attributes: vec![Attribute {
|
||||
name: "new_attribute".into(),
|
||||
value: Serialized::from(&3),
|
||||
}],
|
||||
|
||||
@@ -8,8 +8,8 @@ use async_trait::async_trait;
|
||||
use lldap_domain::{
|
||||
requests::{CreateUserRequest, UpdateUserRequest},
|
||||
types::{
|
||||
AttributeName, AttributeValue, GroupDetails, GroupId, Serialized, User, UserAndGroups,
|
||||
UserId, Uuid,
|
||||
Attribute, AttributeName, GroupDetails, GroupId, Serialized, User, UserAndGroups, UserId,
|
||||
Uuid,
|
||||
},
|
||||
};
|
||||
use sea_orm::{
|
||||
@@ -165,7 +165,7 @@ impl UserListerBackendHandler for SqlBackendHandler {
|
||||
for user in users.iter_mut() {
|
||||
user.user.attributes = attributes_iter
|
||||
.take_while_ref(|u| u.user_id == user.user.user_id)
|
||||
.map(AttributeValue::from)
|
||||
.map(Attribute::from)
|
||||
.collect();
|
||||
}
|
||||
Ok(users)
|
||||
@@ -270,7 +270,7 @@ impl UserBackendHandler for SqlBackendHandler {
|
||||
.order_by_asc(model::UserAttributesColumn::AttributeName)
|
||||
.all(&self.sql_pool)
|
||||
.await?;
|
||||
user.attributes = attributes.into_iter().map(AttributeValue::from).collect();
|
||||
user.attributes = attributes.into_iter().map(Attribute::from).collect();
|
||||
Ok(user)
|
||||
}
|
||||
|
||||
@@ -812,15 +812,15 @@ mod tests {
|
||||
display_name: Some("display_name".to_string()),
|
||||
delete_attributes: Vec::new(),
|
||||
insert_attributes: vec![
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "first_name".into(),
|
||||
value: Serialized::from("first_name"),
|
||||
},
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "last_name".into(),
|
||||
value: Serialized::from("last_name"),
|
||||
},
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "avatar".into(),
|
||||
value: Serialized::from(&JpegPhoto::for_tests()),
|
||||
},
|
||||
@@ -839,15 +839,15 @@ mod tests {
|
||||
assert_eq!(
|
||||
user.attributes,
|
||||
vec![
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "avatar".into(),
|
||||
value: Serialized::from(&JpegPhoto::for_tests())
|
||||
},
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "first_name".into(),
|
||||
value: Serialized::from("first_name")
|
||||
},
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "last_name".into(),
|
||||
value: Serialized::from("last_name")
|
||||
}
|
||||
@@ -864,7 +864,7 @@ mod tests {
|
||||
.update_user(UpdateUserRequest {
|
||||
user_id: UserId::new("bob"),
|
||||
delete_attributes: vec!["last_name".into()],
|
||||
insert_attributes: vec![AttributeValue {
|
||||
insert_attributes: vec![Attribute {
|
||||
name: "avatar".into(),
|
||||
value: Serialized::from(&JpegPhoto::for_tests()),
|
||||
}],
|
||||
@@ -882,11 +882,11 @@ mod tests {
|
||||
assert_eq!(
|
||||
user.attributes,
|
||||
vec![
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "avatar".into(),
|
||||
value: Serialized::from(&JpegPhoto::for_tests())
|
||||
},
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "first_name".into(),
|
||||
value: Serialized::from("first bob")
|
||||
}
|
||||
@@ -902,7 +902,7 @@ mod tests {
|
||||
.handler
|
||||
.update_user(UpdateUserRequest {
|
||||
user_id: UserId::new("bob"),
|
||||
insert_attributes: vec![AttributeValue {
|
||||
insert_attributes: vec![Attribute {
|
||||
name: "first_name".into(),
|
||||
value: Serialized::from("new first"),
|
||||
}],
|
||||
@@ -919,11 +919,11 @@ mod tests {
|
||||
assert_eq!(
|
||||
user.attributes,
|
||||
vec![
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "first_name".into(),
|
||||
value: Serialized::from("new first")
|
||||
},
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "last_name".into(),
|
||||
value: Serialized::from("last bob")
|
||||
}
|
||||
@@ -952,7 +952,7 @@ mod tests {
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
user.attributes,
|
||||
vec![AttributeValue {
|
||||
vec![Attribute {
|
||||
name: "last_name".into(),
|
||||
value: Serialized::from("last bob")
|
||||
}]
|
||||
@@ -968,7 +968,7 @@ mod tests {
|
||||
.update_user(UpdateUserRequest {
|
||||
user_id: UserId::new("bob"),
|
||||
delete_attributes: vec!["first_name".into()],
|
||||
insert_attributes: vec![AttributeValue {
|
||||
insert_attributes: vec![Attribute {
|
||||
name: "first_name".into(),
|
||||
value: Serialized::from("new first"),
|
||||
}],
|
||||
@@ -985,11 +985,11 @@ mod tests {
|
||||
assert_eq!(
|
||||
user.attributes,
|
||||
vec![
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "first_name".into(),
|
||||
value: Serialized::from("new first")
|
||||
},
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "last_name".into(),
|
||||
value: Serialized::from("last bob")
|
||||
},
|
||||
@@ -1005,7 +1005,7 @@ mod tests {
|
||||
.handler
|
||||
.update_user(UpdateUserRequest {
|
||||
user_id: UserId::new("bob"),
|
||||
insert_attributes: vec![AttributeValue {
|
||||
insert_attributes: vec![Attribute {
|
||||
name: "avatar".into(),
|
||||
value: Serialized::from(&JpegPhoto::for_tests()),
|
||||
}],
|
||||
@@ -1019,7 +1019,7 @@ mod tests {
|
||||
.get_user_details(&UserId::new("bob"))
|
||||
.await
|
||||
.unwrap();
|
||||
let avatar = AttributeValue {
|
||||
let avatar = Attribute {
|
||||
name: "avatar".into(),
|
||||
value: Serialized::from(&JpegPhoto::for_tests()),
|
||||
};
|
||||
@@ -1028,7 +1028,7 @@ mod tests {
|
||||
.handler
|
||||
.update_user(UpdateUserRequest {
|
||||
user_id: UserId::new("bob"),
|
||||
insert_attributes: vec![AttributeValue {
|
||||
insert_attributes: vec![Attribute {
|
||||
name: "avatar".into(),
|
||||
value: Serialized::from(&JpegPhoto::null()),
|
||||
}],
|
||||
@@ -1056,15 +1056,15 @@ mod tests {
|
||||
email: "email".into(),
|
||||
display_name: Some("display_name".to_string()),
|
||||
attributes: vec![
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "first_name".into(),
|
||||
value: Serialized::from("First Name"),
|
||||
},
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "last_name".into(),
|
||||
value: Serialized::from("last_name"),
|
||||
},
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "avatar".into(),
|
||||
value: Serialized::from(&JpegPhoto::for_tests()),
|
||||
},
|
||||
@@ -1083,15 +1083,15 @@ mod tests {
|
||||
assert_eq!(
|
||||
user.attributes,
|
||||
vec![
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "avatar".into(),
|
||||
value: Serialized::from(&JpegPhoto::for_tests())
|
||||
},
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "first_name".into(),
|
||||
value: Serialized::from("First Name")
|
||||
},
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "last_name".into(),
|
||||
value: Serialized::from("last_name")
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ use lldap_domain::{
|
||||
},
|
||||
schema::AttributeList,
|
||||
types::{
|
||||
AttributeName, AttributeType, AttributeValue as DomainAttributeValue, Email, GroupId,
|
||||
Attribute as DomainAttribute, AttributeName, AttributeType, Email, GroupId,
|
||||
LdapObjectClass, UserId,
|
||||
},
|
||||
};
|
||||
@@ -137,7 +137,7 @@ impl Success {
|
||||
struct UnpackedAttributes {
|
||||
email: Option<Email>,
|
||||
display_name: Option<String>,
|
||||
attributes: Vec<DomainAttributeValue>,
|
||||
attributes: Vec<DomainAttribute>,
|
||||
}
|
||||
|
||||
fn unpack_attributes(
|
||||
@@ -749,7 +749,7 @@ fn deserialize_attribute(
|
||||
attribute_schema: &AttributeList,
|
||||
attribute: AttributeValue,
|
||||
is_admin: bool,
|
||||
) -> FieldResult<DomainAttributeValue> {
|
||||
) -> FieldResult<DomainAttribute> {
|
||||
let attribute_name = AttributeName::from(attribute.name.as_str());
|
||||
let attribute_schema = attribute_schema
|
||||
.get_attribute_schema(&attribute_name)
|
||||
@@ -774,7 +774,7 @@ fn deserialize_attribute(
|
||||
attribute_schema.is_list,
|
||||
)
|
||||
.context(format!("While deserializing attribute {}", attribute.name))?;
|
||||
Ok(DomainAttributeValue {
|
||||
Ok(DomainAttribute {
|
||||
name: attribute_name,
|
||||
value: deserialized_values,
|
||||
})
|
||||
|
||||
@@ -28,7 +28,7 @@ type DomainGroup = lldap_domain::types::Group;
|
||||
type DomainUserAndGroups = lldap_domain::types::UserAndGroups;
|
||||
type DomainAttributeList = lldap_domain::schema::AttributeList;
|
||||
type DomainAttributeSchema = lldap_domain::schema::AttributeSchema;
|
||||
type DomainAttributeValue = lldap_domain::types::AttributeValue;
|
||||
type DomainAttribute = lldap_domain::types::Attribute;
|
||||
|
||||
#[derive(PartialEq, Eq, Debug, GraphQLInputObject)]
|
||||
/// A filter for requests, specifying a boolean expression based on field constraints. Only one of
|
||||
@@ -578,7 +578,7 @@ impl<Handler: BackendHandler> From<PublicSchema> for Schema<Handler> {
|
||||
|
||||
#[derive(PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
pub struct AttributeValue<Handler: BackendHandler> {
|
||||
attribute: DomainAttributeValue,
|
||||
attribute: DomainAttribute,
|
||||
schema: AttributeSchema<Handler>,
|
||||
_phantom: std::marker::PhantomData<Box<Handler>>,
|
||||
}
|
||||
@@ -599,7 +599,7 @@ impl<Handler: BackendHandler> AttributeValue<Handler> {
|
||||
}
|
||||
|
||||
impl<Handler: BackendHandler> AttributeValue<Handler> {
|
||||
fn from_domain(value: DomainAttributeValue, schema: DomainAttributeSchema) -> Self {
|
||||
fn from_domain(value: DomainAttribute, schema: DomainAttributeSchema) -> Self {
|
||||
Self {
|
||||
attribute: value,
|
||||
schema: AttributeSchema::<Handler> {
|
||||
@@ -622,7 +622,7 @@ impl<Handler: BackendHandler> Clone for AttributeValue<Handler> {
|
||||
}
|
||||
|
||||
pub fn serialize_attribute(
|
||||
attribute: &DomainAttributeValue,
|
||||
attribute: &DomainAttribute,
|
||||
attribute_schema: &DomainAttributeSchema,
|
||||
) -> Vec<String> {
|
||||
let convert_date = |date| chrono::Utc.from_utc_datetime(&date).to_rfc3339();
|
||||
@@ -665,7 +665,7 @@ pub fn serialize_attribute(
|
||||
}
|
||||
|
||||
impl<Handler: BackendHandler> AttributeValue<Handler> {
|
||||
fn from_schema(a: DomainAttributeValue, schema: &DomainAttributeList) -> Option<Self> {
|
||||
fn from_schema(a: DomainAttribute, schema: &DomainAttributeList) -> Option<Self> {
|
||||
schema
|
||||
.get_attribute_schema(&a.name)
|
||||
.map(|s| AttributeValue::<Handler>::from_domain(a, s.clone()))
|
||||
@@ -696,7 +696,7 @@ impl<Handler: BackendHandler> AttributeValue<Handler> {
|
||||
})
|
||||
.map(|(attribute, value)| {
|
||||
AttributeValue::<Handler>::from_domain(
|
||||
DomainAttributeValue {
|
||||
DomainAttribute {
|
||||
name: attribute.name.clone(),
|
||||
value,
|
||||
},
|
||||
@@ -738,7 +738,7 @@ impl<Handler: BackendHandler> AttributeValue<Handler> {
|
||||
})
|
||||
.map(|(attribute, value)| {
|
||||
AttributeValue::<Handler>::from_domain(
|
||||
DomainAttributeValue {
|
||||
DomainAttribute {
|
||||
name: attribute.name.clone(),
|
||||
value,
|
||||
},
|
||||
@@ -780,7 +780,7 @@ impl<Handler: BackendHandler> AttributeValue<Handler> {
|
||||
})
|
||||
.map(|(attribute, value)| {
|
||||
AttributeValue::<Handler>::from_domain(
|
||||
DomainAttributeValue {
|
||||
DomainAttribute {
|
||||
name: attribute.name.clone(),
|
||||
value,
|
||||
},
|
||||
@@ -908,11 +908,11 @@ mod tests {
|
||||
creation_date: chrono::Utc.timestamp_millis_opt(42).unwrap().naive_utc(),
|
||||
uuid: lldap_domain::uuid!("b1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8"),
|
||||
attributes: vec![
|
||||
DomainAttributeValue {
|
||||
DomainAttribute {
|
||||
name: "first_name".into(),
|
||||
value: Serialized::from("Bob"),
|
||||
},
|
||||
DomainAttributeValue {
|
||||
DomainAttribute {
|
||||
name: "last_name".into(),
|
||||
value: Serialized::from("Bobberson"),
|
||||
},
|
||||
@@ -926,7 +926,7 @@ mod tests {
|
||||
display_name: "Bobbersons".into(),
|
||||
creation_date: chrono::Utc.timestamp_nanos(42).naive_utc(),
|
||||
uuid: lldap_domain::uuid!("a1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8"),
|
||||
attributes: vec![DomainAttributeValue {
|
||||
attributes: vec![DomainAttribute {
|
||||
name: "club_name".into(),
|
||||
value: Serialized::from("Gang of Four"),
|
||||
}],
|
||||
|
||||
@@ -28,7 +28,7 @@ use ldap3_proto::proto::{
|
||||
};
|
||||
use lldap_domain::{
|
||||
requests::CreateUserRequest,
|
||||
types::{AttributeName, AttributeType, AttributeValue, Email, Group, UserAndGroups, UserId},
|
||||
types::{Attribute, AttributeName, AttributeType, Email, Group, UserAndGroups, UserId},
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
use tracing::{debug, instrument, warn};
|
||||
@@ -771,7 +771,7 @@ impl<Backend: BackendHandler + LoginHandler + OpaqueHandler> LdapHandler<Backend
|
||||
.map(decode_attribute_value)
|
||||
};
|
||||
let make_encoded_attribute = |name: &str, typ: AttributeType, value: String| {
|
||||
Ok(AttributeValue {
|
||||
Ok(Attribute {
|
||||
name: AttributeName::from(name),
|
||||
value: deserialize::deserialize_attribute_value(&[value], typ, false).map_err(
|
||||
|e| LdapError {
|
||||
@@ -781,7 +781,7 @@ impl<Backend: BackendHandler + LoginHandler + OpaqueHandler> LdapHandler<Backend
|
||||
)?,
|
||||
})
|
||||
};
|
||||
let mut new_user_attributes: Vec<AttributeValue> = Vec::new();
|
||||
let mut new_user_attributes: Vec<Attribute> = Vec::new();
|
||||
if let Some(first_name) = get_attribute("givenname").transpose()? {
|
||||
new_user_attributes.push(make_encoded_attribute(
|
||||
"first_name",
|
||||
@@ -1298,11 +1298,11 @@ mod tests {
|
||||
display_name: Some("Bôb Böbberson".to_string()),
|
||||
uuid: uuid!("698e1d5f-7a40-3151-8745-b9b8a37839da"),
|
||||
attributes: vec![
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "first_name".into(),
|
||||
value: Serialized::from("Bôb"),
|
||||
},
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "last_name".into(),
|
||||
value: Serialized::from("Böbberson"),
|
||||
},
|
||||
@@ -1317,15 +1317,15 @@ mod tests {
|
||||
email: "jim@cricket.jim".into(),
|
||||
display_name: Some("Jimminy Cricket".to_string()),
|
||||
attributes: vec![
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "avatar".into(),
|
||||
value: Serialized::from(&JpegPhoto::for_tests()),
|
||||
},
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "first_name".into(),
|
||||
value: Serialized::from("Jim"),
|
||||
},
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "last_name".into(),
|
||||
value: Serialized::from("Cricket"),
|
||||
},
|
||||
@@ -1735,7 +1735,7 @@ mod tests {
|
||||
creation_date: chrono::Utc.timestamp_opt(42, 42).unwrap().naive_utc(),
|
||||
users: vec![],
|
||||
uuid: uuid!("04ac75e0-2900-3e21-926c-2f732c26b3fc"),
|
||||
attributes: vec![AttributeValue {
|
||||
attributes: vec![Attribute {
|
||||
name: "Attr".into(),
|
||||
value: Serialized::from("TEST"),
|
||||
}],
|
||||
@@ -2171,11 +2171,11 @@ mod tests {
|
||||
email: "bob@bobmail.bob".into(),
|
||||
display_name: Some("Bôb Böbberson".to_string()),
|
||||
attributes: vec![
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "first_name".into(),
|
||||
value: Serialized::from("Bôb"),
|
||||
},
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "last_name".into(),
|
||||
value: Serialized::from("Böbberson"),
|
||||
},
|
||||
@@ -2255,11 +2255,11 @@ mod tests {
|
||||
email: "bob@bobmail.bob".into(),
|
||||
display_name: Some("Bôb Böbberson".to_string()),
|
||||
attributes: vec![
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "avatar".into(),
|
||||
value: Serialized::from(&JpegPhoto::for_tests()),
|
||||
},
|
||||
AttributeValue {
|
||||
Attribute {
|
||||
name: "last_name".into(),
|
||||
value: Serialized::from("Böbberson"),
|
||||
},
|
||||
@@ -3076,7 +3076,7 @@ mod tests {
|
||||
Ok(vec![UserAndGroups {
|
||||
user: User {
|
||||
user_id: UserId::new("test"),
|
||||
attributes: vec![AttributeValue {
|
||||
attributes: vec![Attribute {
|
||||
name: "nickname".into(),
|
||||
value: Serialized::from("Bob the Builder"),
|
||||
}],
|
||||
@@ -3092,7 +3092,7 @@ mod tests {
|
||||
creation_date: chrono::Utc.timestamp_opt(42, 42).unwrap().naive_utc(),
|
||||
users: vec![UserId::new("bob")],
|
||||
uuid: uuid!("04ac75e0-2900-3e21-926c-2f732c26b3fc"),
|
||||
attributes: vec![AttributeValue {
|
||||
attributes: vec![Attribute {
|
||||
name: "club_name".into(),
|
||||
value: Serialized::from("Breakfast Club"),
|
||||
}],
|
||||
|
||||
Reference in New Issue
Block a user