mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 20:47:01 +01:00
fmt
This commit is contained in:
parent
3d38723fa1
commit
b91aae4428
|
@ -197,24 +197,20 @@ impl Entry {
|
||||||
match self.attrs.get(attr) {
|
match self.attrs.get(attr) {
|
||||||
Some(values) => {
|
Some(values) => {
|
||||||
for v in values {
|
for v in values {
|
||||||
pairs.push( (attr.clone(), v.clone() ) )
|
pairs.push((attr.clone(), v.clone()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {
|
None => return None,
|
||||||
return None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now make this a filter?
|
// Now make this a filter?
|
||||||
|
|
||||||
let eq_filters = pairs.into_iter()
|
let eq_filters = pairs
|
||||||
.map(|(attr, value)| {
|
.into_iter()
|
||||||
Filter::Eq(attr, value)
|
.map(|(attr, value)| Filter::Eq(attr, value))
|
||||||
})
|
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
|
||||||
Some(Filter::And(eq_filters))
|
Some(Filter::And(eq_filters))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ impl CreateEvent {
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct ExistsEvent {
|
pub struct ExistsEvent {
|
||||||
pub filter: Filter,
|
pub filter: Filter,
|
||||||
pub internal: bool
|
pub internal: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Message for ExistsEvent {
|
impl Message for ExistsEvent {
|
||||||
|
|
|
@ -11,7 +11,7 @@ use be::{
|
||||||
|
|
||||||
use entry::Entry;
|
use entry::Entry;
|
||||||
use error::OperationError;
|
use error::OperationError;
|
||||||
use event::{CreateEvent, OpResult, SearchEvent, SearchResult, ExistsEvent};
|
use event::{CreateEvent, ExistsEvent, OpResult, SearchEvent, SearchResult};
|
||||||
use filter::Filter;
|
use filter::Filter;
|
||||||
use log::EventLog;
|
use log::EventLog;
|
||||||
use plugins::Plugins;
|
use plugins::Plugins;
|
||||||
|
@ -392,7 +392,11 @@ impl<'a> QueryServerWriteTransaction<'a> {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn internal_migrate_or_create(&self, audit: &mut AuditScope, e: Entry) -> Result<(), OperationError> {
|
pub fn internal_migrate_or_create(
|
||||||
|
&self,
|
||||||
|
audit: &mut AuditScope,
|
||||||
|
e: Entry,
|
||||||
|
) -> Result<(), OperationError> {
|
||||||
// if the thing exists, ensure the set of attributes on
|
// if the thing exists, ensure the set of attributes on
|
||||||
// Entry A match and are present (but don't delete multivalue, or extended
|
// Entry A match and are present (but don't delete multivalue, or extended
|
||||||
// attributes in the situation.
|
// attributes in the situation.
|
||||||
|
@ -426,7 +430,11 @@ impl<'a> QueryServerWriteTransaction<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should this take a be_txn?
|
// Should this take a be_txn?
|
||||||
pub fn internal_assert_or_create(&self, audit: &mut AuditScope, e: Entry) -> Result<(), OperationError> {
|
pub fn internal_assert_or_create(
|
||||||
|
&self,
|
||||||
|
audit: &mut AuditScope,
|
||||||
|
e: Entry,
|
||||||
|
) -> Result<(), OperationError> {
|
||||||
// If exists, ensure the object is exactly as provided
|
// If exists, ensure the object is exactly as provided
|
||||||
// else, if not exists, create it. IE no extra or excess
|
// else, if not exists, create it. IE no extra or excess
|
||||||
// attributes and classes.
|
// attributes and classes.
|
||||||
|
@ -458,7 +466,11 @@ impl<'a> QueryServerWriteTransaction<'a> {
|
||||||
// is the "internal" version, where we define the event as being internal
|
// is the "internal" version, where we define the event as being internal
|
||||||
// only, allowing certain plugin by passes etc.
|
// only, allowing certain plugin by passes etc.
|
||||||
|
|
||||||
pub fn internal_create(&self, audit: &mut AuditScope, entries: Vec<Entry>) -> Result<(), OperationError> {
|
pub fn internal_create(
|
||||||
|
&self,
|
||||||
|
audit: &mut AuditScope,
|
||||||
|
entries: Vec<Entry>,
|
||||||
|
) -> Result<(), OperationError> {
|
||||||
// Start the audit scope
|
// Start the audit scope
|
||||||
let mut audit_int = AuditScope::new("internal_create");
|
let mut audit_int = AuditScope::new("internal_create");
|
||||||
// Create the CreateEvent
|
// Create the CreateEvent
|
||||||
|
|
Loading…
Reference in a new issue