mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 20:47:01 +01:00
Resolve domain_name overwrite on startup issue
This commit is contained in:
parent
7fcb0e6069
commit
646261ebf7
|
@ -456,8 +456,7 @@ pub static JSON_DOMAIN_INFO_V1: &'static str = r#"{
|
||||||
"class": ["object", "domain_info", "system"],
|
"class": ["object", "domain_info", "system"],
|
||||||
"name": ["domain_local"],
|
"name": ["domain_local"],
|
||||||
"uuid": ["00000000-0000-0000-0000-ffffff000025"],
|
"uuid": ["00000000-0000-0000-0000-ffffff000025"],
|
||||||
"description": ["This local domain's info and metadata object."],
|
"description": ["This local domain's info and metadata object."]
|
||||||
"domain_name": ["example.com"]
|
|
||||||
}
|
}
|
||||||
}"#;
|
}"#;
|
||||||
|
|
||||||
|
|
|
@ -34,12 +34,17 @@ impl Plugin for Domain {
|
||||||
) -> Result<(), OperationError> {
|
) -> Result<(), OperationError> {
|
||||||
audit_log!(au, "Entering base pre_create_transform");
|
audit_log!(au, "Entering base pre_create_transform");
|
||||||
cand.iter_mut().for_each(|e| {
|
cand.iter_mut().for_each(|e| {
|
||||||
if e.attribute_value_pres("class", &PVCLASS_DOMAIN_INFO)
|
if e.attribute_value_pres("class", &PVCLASS_DOMAIN_INFO) {
|
||||||
&& !e.attribute_pres("domain_uuid")
|
if !e.attribute_pres("domain_uuid") {
|
||||||
{
|
|
||||||
let u = Value::new_uuid(Uuid::new_v4());
|
let u = Value::new_uuid(Uuid::new_v4());
|
||||||
e.set_avas("domain_uuid", vec![u]);
|
e.set_avas("domain_uuid", vec![u]);
|
||||||
audit_log!(au, "plugin_domain: Applying uuid transform");
|
audit_log!(au, "plugin_domain: Applying uuid transform");
|
||||||
|
}
|
||||||
|
if !e.attribute_pres("domain_name") {
|
||||||
|
let n = Value::new_iutf8s("example.com");
|
||||||
|
e.set_avas("domain_name", vec![n]);
|
||||||
|
audit_log!(au, "plugin_domain: Applying domain_name transform");
|
||||||
|
}
|
||||||
audit_log!(au, "{:?}", e);
|
audit_log!(au, "{:?}", e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue