mirror of
https://github.com/kanidm/kanidm.git
synced 2025-05-01 22:55:06 +02:00
Uhoh
This commit is contained in:
parent
96f8bdcea3
commit
722a11bb81
|
@ -213,6 +213,7 @@ pub enum OperationError {
|
||||||
SC0024SshPublicKeySyntaxInvalid,
|
SC0024SshPublicKeySyntaxInvalid,
|
||||||
SC0025UiHintSyntaxInvalid,
|
SC0025UiHintSyntaxInvalid,
|
||||||
SC0026Utf8SyntaxInvalid,
|
SC0026Utf8SyntaxInvalid,
|
||||||
|
SC0027ClassSetInvalid,
|
||||||
// Migration
|
// Migration
|
||||||
MG0001InvalidReMigrationLevel,
|
MG0001InvalidReMigrationLevel,
|
||||||
MG0002RaiseDomainLevelExceedsMaximum,
|
MG0002RaiseDomainLevelExceedsMaximum,
|
||||||
|
@ -492,6 +493,7 @@ impl OperationError {
|
||||||
Self::SC0024SshPublicKeySyntaxInvalid => Some("A SCIM Ssh Public Key contained invalid syntax".into()),
|
Self::SC0024SshPublicKeySyntaxInvalid => Some("A SCIM Ssh Public Key contained invalid syntax".into()),
|
||||||
Self::SC0025UiHintSyntaxInvalid => Some("A SCIM UiHint contained invalid syntax".into()),
|
Self::SC0025UiHintSyntaxInvalid => Some("A SCIM UiHint contained invalid syntax".into()),
|
||||||
Self::SC0026Utf8SyntaxInvalid => Some("A SCIM Utf8 String Scope Map contained invalid syntax".into()),
|
Self::SC0026Utf8SyntaxInvalid => Some("A SCIM Utf8 String Scope Map contained invalid syntax".into()),
|
||||||
|
Self::SC0027ClassSetInvalid => Some("The internal set of class templates used in this create operation was invalid. THIS IS A BUG.".into()),
|
||||||
|
|
||||||
Self::UI0001ChallengeSerialisation => Some("The WebAuthn challenge was unable to be serialised.".into()),
|
Self::UI0001ChallengeSerialisation => Some("The WebAuthn challenge was unable to be serialised.".into()),
|
||||||
Self::UI0002InvalidState => Some("The credential update process returned an invalid state transition.".into()),
|
Self::UI0002InvalidState => Some("The credential update process returned an invalid state transition.".into()),
|
||||||
|
|
|
@ -202,7 +202,7 @@ impl QueryServerWriteV1 {
|
||||||
e
|
e
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let scim_create_event = ScimCreateEvent::try_from(ident, classes, entry, idms_prox_write)?;
|
let scim_create_event = ScimCreateEvent::try_from(ident, classes, entry, &mut idms_prox_write.qs_write)?;
|
||||||
|
|
||||||
idms_prox_write
|
idms_prox_write
|
||||||
.qs_write
|
.qs_write
|
||||||
|
|
|
@ -488,6 +488,11 @@ impl Entry<EntryInit, EntryNew> {
|
||||||
self.attrs.remove(attr);
|
self.attrs.remove(attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Set the content of this ava with this valueset, ignoring the previous data.
|
||||||
|
pub fn set_ava_set(&mut self, attr: &Attribute, vs: ValueSet) {
|
||||||
|
self.attrs.insert(attr.clone(), vs);
|
||||||
|
}
|
||||||
|
|
||||||
/// Replace the existing content of an attribute set of this Entry, with a new set of Values.
|
/// Replace the existing content of an attribute set of this Entry, with a new set of Values.
|
||||||
pub fn set_ava<T>(&mut self, attr: Attribute, iter: T)
|
pub fn set_ava<T>(&mut self, attr: Attribute, iter: T)
|
||||||
where
|
where
|
||||||
|
|
|
@ -65,14 +65,24 @@ impl ScimCreateEvent {
|
||||||
entry: ScimEntryPostGeneric,
|
entry: ScimEntryPostGeneric,
|
||||||
qs: &mut QueryServerWriteTransaction,
|
qs: &mut QueryServerWriteTransaction,
|
||||||
) -> Result<Self, OperationError> {
|
) -> Result<Self, OperationError> {
|
||||||
let entry = entry
|
let mut entry = entry
|
||||||
.attrs
|
.attrs
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(attr, json_value)| {
|
.map(|(attr, json_value)| {
|
||||||
qs.resolve_scim_json_post(&attr, json_value)
|
qs.resolve_scim_json_post(&attr, json_value)
|
||||||
.map(|kani_value| (attr, kani_value))
|
.map(|kani_value| (attr, kani_value))
|
||||||
})
|
})
|
||||||
.collect::<Result<_, _>>()?;
|
.collect::<Result<EntryInitNew, _>>()?;
|
||||||
|
|
||||||
|
|
||||||
|
let classes =
|
||||||
|
ValueSetIutf8::from_iter(
|
||||||
|
classes.iter()
|
||||||
|
.map(|cls| cls.as_ref())
|
||||||
|
)
|
||||||
|
.ok_or(OperationError::SC0027ClassSetInvalid)?;
|
||||||
|
|
||||||
|
entry.set_ava_set(&Attribute::Class, classes);
|
||||||
|
|
||||||
Ok(ScimCreateEvent { ident, entry })
|
Ok(ScimCreateEvent { ident, entry })
|
||||||
}
|
}
|
||||||
|
@ -169,8 +179,17 @@ impl QueryServerWriteTransaction<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn scim_create(&mut self, _scim_create: ScimCreateEvent) -> Result<(), OperationError> {
|
pub fn scim_create(&mut self, scim_create: ScimCreateEvent) -> Result<(), OperationError> {
|
||||||
todo!();
|
let ScimCreateEvent {
|
||||||
|
ident, entry
|
||||||
|
} = scim_create;
|
||||||
|
|
||||||
|
let create_event = CreateEvent {
|
||||||
|
ident,
|
||||||
|
entries: vec![entry],
|
||||||
|
};
|
||||||
|
|
||||||
|
self.create(&create_event)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn scim_delete(&mut self, scim_delete: ScimDeleteEvent) -> Result<(), OperationError> {
|
pub fn scim_delete(&mut self, scim_delete: ScimDeleteEvent) -> Result<(), OperationError> {
|
||||||
|
|
Loading…
Reference in a new issue