mirror of
https://github.com/kanidm/kanidm.git
synced 2025-05-22 17:03:55 +02:00
Formatting
This commit is contained in:
parent
f842f92ff1
commit
d63364d870
|
@ -2395,9 +2395,12 @@ mod tests {
|
|||
|
||||
let single_result = be.create(&CID_ZERO, vec![e]);
|
||||
assert!(single_result.is_ok());
|
||||
|
||||
|
||||
// Test Search with or condition including invalid attribute
|
||||
let filt = filter_resolved!(f_or(vec![f_eq(Attribute::UserId, PartialValue::new_utf8s("bagel")), f_invalid(Attribute::UserId)]));
|
||||
let filt = filter_resolved!(f_or(vec![
|
||||
f_eq(Attribute::UserId, PartialValue::new_utf8s("bagel")),
|
||||
f_invalid(Attribute::UserId)
|
||||
]));
|
||||
|
||||
let lims = Limits::unlimited();
|
||||
|
||||
|
@ -2405,7 +2408,10 @@ mod tests {
|
|||
assert!(r.expect("Search failed!").len() == 1);
|
||||
|
||||
// Test Search with or condition including invalid attribute
|
||||
let filt = filter_resolved!(f_and(vec![f_eq(Attribute::UserId, PartialValue::new_utf8s("bagel")), f_invalid(Attribute::UserId)]));
|
||||
let filt = filter_resolved!(f_and(vec![
|
||||
f_eq(Attribute::UserId, PartialValue::new_utf8s("bagel")),
|
||||
f_invalid(Attribute::UserId)
|
||||
]));
|
||||
|
||||
let lims = Limits::unlimited();
|
||||
|
||||
|
|
|
@ -2912,9 +2912,7 @@ impl<VALID, STATE> Entry<VALID, STATE> {
|
|||
false
|
||||
}
|
||||
FilterResolved::AndNot(f, _) => !self.entry_match_no_index_inner(f),
|
||||
FilterResolved::Invalid(_) => {
|
||||
false
|
||||
}
|
||||
FilterResolved::Invalid(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -969,7 +969,7 @@ impl FilterComp {
|
|||
}
|
||||
FilterComp::Invalid(attr) => {
|
||||
// FilterComp may be invalid but Invalid is still a valid value.
|
||||
// we continue the evaluation so OR queries can still succeed
|
||||
// we continue the evaluation so OR queries can still succeed
|
||||
Ok(FilterComp::Invalid(attr.clone()))
|
||||
}
|
||||
}
|
||||
|
@ -1119,10 +1119,10 @@ impl FilterComp {
|
|||
let a = ldap_attr_filter_map(a);
|
||||
let pv = qs.clone_partialvalue(&a, v);
|
||||
|
||||
match pv {
|
||||
Ok(pv) => FilterComp::Eq(a, pv),
|
||||
Err(_) if a == Attribute::Spn => FilterComp::Invalid(a),
|
||||
Err(err) => return Err(err),
|
||||
match pv {
|
||||
Ok(pv) => FilterComp::Eq(a, pv),
|
||||
Err(_) if a == Attribute::Spn => FilterComp::Invalid(a),
|
||||
Err(err) => return Err(err),
|
||||
}
|
||||
}
|
||||
LdapFilter::Present(a) => FilterComp::Pres(ldap_attr_filter_map(a)),
|
||||
|
@ -1462,9 +1462,7 @@ impl FilterResolved {
|
|||
FilterResolved::resolve_idx((*f).clone(), ev, idxmeta)
|
||||
.map(|fi| FilterResolved::AndNot(Box::new(fi), None))
|
||||
}
|
||||
FilterComp::Invalid(attr) => {
|
||||
Some(FilterResolved::Invalid(attr))
|
||||
},
|
||||
FilterComp::Invalid(attr) => Some(FilterResolved::Invalid(attr)),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1157,7 +1157,7 @@ mod tests {
|
|||
assert!(!r1.is_empty());
|
||||
assert_eq!(r1.len(), r2.len());
|
||||
}
|
||||
|
||||
|
||||
#[idm_test]
|
||||
async fn test_ldap_spn_search(idms: &IdmServer, _idms_delayed: &IdmServerDelayed) {
|
||||
let ldaps = LdapServer::new(idms).await.expect("failed to start ldap");
|
||||
|
@ -1207,11 +1207,15 @@ mod tests {
|
|||
let result = ldaps
|
||||
.do_search(idms, &sr, &anon_t, Source::Internal)
|
||||
.await
|
||||
.map(|r| r.into_iter().filter(|r| matches!(r.op, LdapOp::SearchResultEntry(_))).collect::<Vec<_>>())
|
||||
.map(|r| {
|
||||
r.into_iter()
|
||||
.filter(|r| matches!(r.op, LdapOp::SearchResultEntry(_)))
|
||||
.collect::<Vec<_>>()
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
|
||||
assert!(!result.is_empty());
|
||||
|
||||
|
||||
let sr = SearchRequest {
|
||||
msgid: 1,
|
||||
base: format!("dc=example,dc=com"),
|
||||
|
@ -1226,7 +1230,11 @@ mod tests {
|
|||
let empty_result = ldaps
|
||||
.do_search(idms, &sr, &anon_t, Source::Internal)
|
||||
.await
|
||||
.map(|r| r.into_iter().filter(|r| matches!(r.op, LdapOp::SearchResultEntry(_))).collect::<Vec<_>>())
|
||||
.map(|r| {
|
||||
r.into_iter()
|
||||
.filter(|r| matches!(r.op, LdapOp::SearchResultEntry(_)))
|
||||
.collect::<Vec<_>>()
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
assert!(empty_result.is_empty());
|
||||
|
|
|
@ -89,8 +89,8 @@ pub mod prelude {
|
|||
};
|
||||
pub use crate::event::{CreateEvent, DeleteEvent, ExistsEvent, ModifyEvent, SearchEvent};
|
||||
pub use crate::filter::{
|
||||
f_and, f_andnot, f_eq, f_id, f_inc, f_lt, f_or, f_pres, f_self, f_spn_name, f_sub, f_invalid, Filter,
|
||||
FilterInvalid, FilterValid, FC,
|
||||
f_and, f_andnot, f_eq, f_id, f_inc, f_invalid, f_lt, f_or, f_pres, f_self, f_spn_name,
|
||||
f_sub, Filter, FilterInvalid, FilterValid, FC,
|
||||
};
|
||||
pub use crate::idm::server::{IdmServer, IdmServerAudit, IdmServerDelayed};
|
||||
pub use crate::idm::{ClientAuthInfo, ClientCertInfo};
|
||||
|
|
Loading…
Reference in a new issue