mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 12:37:00 +01:00
fmt
This commit is contained in:
parent
341f7cd0c5
commit
71f4becd5f
|
@ -1,4 +1,3 @@
|
|||
|
||||
pub static PURGE_TIMEOUT: u64 = 3600;
|
||||
|
||||
pub static UUID_ADMIN: &'static str = "00000000-0000-0000-0000-000000000000";
|
||||
|
@ -55,7 +54,6 @@ pub static UUID_SCHEMA_CLASS_EXTENSIBLEOBJECT: &'static str =
|
|||
pub static UUID_SCHEMA_CLASS_RECYCLED: &'static str = "813bb7e3-dadf-413d-acc4-197b03d55a4f";
|
||||
pub static UUID_SCHEMA_CLASS_TOMBSTONE: &'static str = "848a1224-0c3c-465f-abd0-10a32e21830e";
|
||||
|
||||
|
||||
// system supplementary
|
||||
pub static UUID_SCHEMA_ATTR_DISPLAYNAME: &'static str = "201bc966-954b-48f5-bf25-99ffed759861";
|
||||
pub static UUID_SCHEMA_ATTR_MAIL: &'static str = "fae94676-720b-461b-9438-bfe8cfd7e6cd";
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
// use actix::SystemRunner;
|
||||
use actix::Actor;
|
||||
use actix_web::middleware::session::{self, RequestSession};
|
||||
use actix_web::{
|
||||
error, http, middleware, App, AsyncResponder, Error, FutureResponse, HttpMessage, HttpRequest,
|
||||
HttpResponse, Path, Result, State,
|
||||
};
|
||||
use actix::Actor;
|
||||
|
||||
use bytes::BytesMut;
|
||||
use futures::{future, Future, Stream};
|
||||
|
@ -14,14 +14,13 @@ use super::config::Configuration;
|
|||
// SearchResult
|
||||
use super::event::{AuthEvent, CreateEvent, DeleteEvent, ModifyEvent, SearchEvent};
|
||||
use super::filter::Filter;
|
||||
use super::interval::IntervalActor;
|
||||
use super::log;
|
||||
use super::proto_v1::{
|
||||
AuthRequest, AuthResponse, CreateRequest, DeleteRequest, ModifyRequest, SearchRequest,
|
||||
};
|
||||
use super::interval::IntervalActor;
|
||||
use super::server;
|
||||
|
||||
|
||||
struct AppState {
|
||||
qe: actix::Addr<server::QueryServer>,
|
||||
max_size: usize,
|
||||
|
|
|
@ -381,7 +381,9 @@ impl Entry<EntryValid, EntryCommitted> {
|
|||
|
||||
pub fn to_tombstone(&self) -> Self {
|
||||
// Duplicate this to a tombstone entry.
|
||||
let uuid_ava = self.get_ava(&String::from("uuid")).expect("Corrupted entry!");
|
||||
let uuid_ava = self
|
||||
.get_ava(&String::from("uuid"))
|
||||
.expect("Corrupted entry!");
|
||||
let class_ava = vec!["object".to_string(), "tombstone".to_string()];
|
||||
|
||||
let mut attrs_new: BTreeMap<String, Vec<String>> = BTreeMap::new();
|
||||
|
|
|
@ -2,7 +2,7 @@ use super::filter::{Filter, FilterInvalid};
|
|||
use super::proto_v1::Entry as ProtoEntry;
|
||||
use super::proto_v1::{
|
||||
AuthRequest, AuthResponse, AuthStatus, CreateRequest, DeleteRequest, ModifyRequest, Response,
|
||||
SearchRequest, SearchResponse, SearchRecycledRequest, ReviveRecycledRequest
|
||||
ReviveRecycledRequest, SearchRecycledRequest, SearchRequest, SearchResponse,
|
||||
};
|
||||
use actix::prelude::*;
|
||||
use entry::{Entry, EntryCommitted, EntryInvalid, EntryNew, EntryValid};
|
||||
|
@ -73,20 +73,12 @@ impl SearchEvent {
|
|||
SearchEvent {
|
||||
internal: false,
|
||||
filter: Filter::And(vec![
|
||||
Filter::AndNot(Box::new(
|
||||
Filter::Or(vec![
|
||||
Filter::Eq(
|
||||
"class".to_string(),
|
||||
"tombstone".to_string(),
|
||||
),
|
||||
Filter::Eq(
|
||||
"class".to_string(),
|
||||
"recycled".to_string(),
|
||||
)
|
||||
])
|
||||
)),
|
||||
Filter::from(&request.filter)
|
||||
]),
|
||||
Filter::AndNot(Box::new(Filter::Or(vec![
|
||||
Filter::Eq("class".to_string(), "tombstone".to_string()),
|
||||
Filter::Eq("class".to_string(), "recycled".to_string()),
|
||||
]))),
|
||||
Filter::from(&request.filter),
|
||||
]),
|
||||
class: (),
|
||||
}
|
||||
}
|
||||
|
@ -102,12 +94,9 @@ impl SearchEvent {
|
|||
pub fn from_rec_request(request: SearchRecycledRequest) -> Self {
|
||||
SearchEvent {
|
||||
filter: Filter::And(vec![
|
||||
Filter::Eq(
|
||||
"class".to_string(),
|
||||
"recycled".to_string(),
|
||||
),
|
||||
Filter::from(&request.filter)
|
||||
]),
|
||||
Filter::Eq("class".to_string(), "recycled".to_string()),
|
||||
Filter::from(&request.filter),
|
||||
]),
|
||||
internal: false,
|
||||
class: (),
|
||||
}
|
||||
|
@ -201,20 +190,12 @@ impl DeleteEvent {
|
|||
pub fn from_request(request: DeleteRequest) -> Self {
|
||||
DeleteEvent {
|
||||
filter: Filter::And(vec![
|
||||
Filter::AndNot(Box::new(
|
||||
Filter::Or(vec![
|
||||
Filter::Eq(
|
||||
"class".to_string(),
|
||||
"tombstone".to_string(),
|
||||
),
|
||||
Filter::Eq(
|
||||
"class".to_string(),
|
||||
"recycled".to_string(),
|
||||
)
|
||||
])
|
||||
)),
|
||||
Filter::from(&request.filter)
|
||||
]),
|
||||
Filter::AndNot(Box::new(Filter::Or(vec![
|
||||
Filter::Eq("class".to_string(), "tombstone".to_string()),
|
||||
Filter::Eq("class".to_string(), "recycled".to_string()),
|
||||
]))),
|
||||
Filter::from(&request.filter),
|
||||
]),
|
||||
internal: false,
|
||||
}
|
||||
}
|
||||
|
@ -250,22 +231,14 @@ impl ModifyEvent {
|
|||
pub fn from_request(request: ModifyRequest) -> Self {
|
||||
ModifyEvent {
|
||||
filter: Filter::And(vec![
|
||||
Filter::AndNot(Box::new(
|
||||
Filter::Or(vec![
|
||||
Filter::Eq(
|
||||
"class".to_string(),
|
||||
"tombstone".to_string(),
|
||||
),
|
||||
Filter::Eq(
|
||||
"class".to_string(),
|
||||
"recycled".to_string(),
|
||||
)
|
||||
])
|
||||
)),
|
||||
Filter::from(&request.filter)
|
||||
]),
|
||||
Filter::AndNot(Box::new(Filter::Or(vec![
|
||||
Filter::Eq("class".to_string(), "tombstone".to_string()),
|
||||
Filter::Eq("class".to_string(), "recycled".to_string()),
|
||||
]))),
|
||||
Filter::from(&request.filter),
|
||||
]),
|
||||
modlist: ModifyList::from(&request.modlist),
|
||||
internal: false
|
||||
internal: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -310,7 +283,6 @@ impl AuthResult {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct PurgeEvent {}
|
||||
|
||||
|
@ -338,12 +310,9 @@ impl ReviveRecycledEvent {
|
|||
pub fn from_request(request: ReviveRecycledRequest) -> Self {
|
||||
ReviveRecycledEvent {
|
||||
filter: Filter::And(vec![
|
||||
Filter::Eq(
|
||||
"class".to_string(),
|
||||
"recycled".to_string(),
|
||||
),
|
||||
Filter::from(&request.filter)
|
||||
]),
|
||||
Filter::Eq("class".to_string(), "recycled".to_string()),
|
||||
Filter::from(&request.filter),
|
||||
]),
|
||||
internal: false,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
use std::time::Duration;
|
||||
use actix::prelude::*;
|
||||
use std::time::Duration;
|
||||
|
||||
use server::QueryServer;
|
||||
use event::PurgeEvent;
|
||||
use constants::PURGE_TIMEOUT;
|
||||
|
||||
use event::PurgeEvent;
|
||||
use server::QueryServer;
|
||||
|
||||
pub struct IntervalActor {
|
||||
// Store any addresses we require
|
||||
|
@ -13,9 +12,7 @@ pub struct IntervalActor {
|
|||
|
||||
impl IntervalActor {
|
||||
pub fn new(server: actix::Addr<QueryServer>) -> Self {
|
||||
IntervalActor {
|
||||
server: server,
|
||||
}
|
||||
IntervalActor { server: server }
|
||||
}
|
||||
|
||||
// Define new events here
|
||||
|
@ -35,4 +32,3 @@ impl Actor for IntervalActor {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use proto_v1::ModifyList as ProtoModifyList;
|
||||
use proto_v1::Modify as ProtoModify;
|
||||
use proto_v1::ModifyList as ProtoModifyList;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub enum Modify {
|
||||
|
@ -14,15 +14,9 @@ pub enum Modify {
|
|||
impl Modify {
|
||||
pub fn from(m: &ProtoModify) -> Self {
|
||||
match m {
|
||||
ProtoModify::Present(a, v) => {
|
||||
Modify::Present(a.clone(), v.clone())
|
||||
}
|
||||
ProtoModify::Removed(a, v) => {
|
||||
Modify::Removed(a.clone(), v.clone())
|
||||
}
|
||||
ProtoModify::Purged(a) => {
|
||||
Modify::Purged(a.clone())
|
||||
}
|
||||
ProtoModify::Present(a, v) => Modify::Present(a.clone(), v.clone()),
|
||||
ProtoModify::Removed(a, v) => Modify::Removed(a.clone(), v.clone()),
|
||||
ProtoModify::Purged(a) => Modify::Purged(a.clone()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,11 +48,7 @@ impl ModifyList {
|
|||
// For each ProtoModify, do a from.
|
||||
|
||||
ModifyList {
|
||||
mods: ml.mods.iter()
|
||||
.map(|pm| {
|
||||
Modify::from(pm)
|
||||
})
|
||||
.collect()
|
||||
mods: ml.mods.iter().map(|pm| Modify::from(pm)).collect(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -27,7 +27,6 @@ pub enum Filter {
|
|||
AndNot(Box<Filter>),
|
||||
}
|
||||
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
pub enum Modify {
|
||||
Present(String, String),
|
||||
|
@ -169,7 +168,6 @@ pub struct AuthResponse {
|
|||
pub status: AuthStatus,
|
||||
}
|
||||
|
||||
|
||||
/* Recycle Requests area */
|
||||
|
||||
// Only two actions on recycled is possible. Search and Revive.
|
||||
|
@ -184,7 +182,6 @@ impl SearchRecycledRequest {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Need a search response here later.
|
||||
|
||||
pub struct ReviveRecycledRequest {
|
||||
|
|
|
@ -593,7 +593,9 @@ impl SchemaInner {
|
|||
SchemaClass {
|
||||
name: String::from("extensibleobject"),
|
||||
uuid: Uuid::parse_str(UUID_SCHEMA_CLASS_EXTENSIBLEOBJECT).unwrap(),
|
||||
description: String::from("A class type that has green hair and turns off all rules ..."),
|
||||
description: String::from(
|
||||
"A class type that has green hair and turns off all rules ...",
|
||||
),
|
||||
systemmay: vec![],
|
||||
may: vec![],
|
||||
systemmust: vec![],
|
||||
|
@ -781,10 +783,7 @@ impl SchemaInner {
|
|||
// String::from("gidnumber"),
|
||||
],
|
||||
may: vec![],
|
||||
systemmust: vec![
|
||||
String::from("displayname"),
|
||||
String::from("name")
|
||||
],
|
||||
systemmust: vec![String::from("displayname"), String::from("name")],
|
||||
must: vec![],
|
||||
},
|
||||
);
|
||||
|
@ -800,10 +799,7 @@ impl SchemaInner {
|
|||
// String::from("password"),
|
||||
],
|
||||
may: vec![],
|
||||
systemmust: vec![
|
||||
String::from("displayname"),
|
||||
String::from("name")
|
||||
],
|
||||
systemmust: vec![String::from("displayname"), String::from("name")],
|
||||
must: vec![],
|
||||
},
|
||||
);
|
||||
|
@ -818,9 +814,7 @@ impl SchemaInner {
|
|||
// String::from("gidnumber"),
|
||||
],
|
||||
may: vec![],
|
||||
systemmust: vec![
|
||||
String::from("name"),
|
||||
],
|
||||
systemmust: vec![String::from("name")],
|
||||
must: vec![],
|
||||
},
|
||||
);
|
||||
|
|
|
@ -14,11 +14,11 @@ use entry::{Entry, EntryCommitted, EntryInvalid, EntryNew, EntryValid};
|
|||
use error::{OperationError, SchemaError};
|
||||
use event::{
|
||||
AuthEvent, AuthResult, CreateEvent, DeleteEvent, ExistsEvent, ModifyEvent, OpResult,
|
||||
SearchEvent, SearchResult, PurgeEvent, ReviveRecycledEvent
|
||||
PurgeEvent, ReviveRecycledEvent, SearchEvent, SearchResult,
|
||||
};
|
||||
use filter::{Filter, FilterInvalid};
|
||||
use log::EventLog;
|
||||
use modify::{ModifyList, Modify};
|
||||
use modify::{Modify, ModifyList};
|
||||
use plugins::Plugins;
|
||||
use schema::{Schema, SchemaReadTransaction, SchemaTransaction, SchemaWriteTransaction};
|
||||
|
||||
|
@ -433,16 +433,11 @@ impl<'a> QueryServerWriteTransaction<'a> {
|
|||
// delete everything that is a tombstone.
|
||||
|
||||
// Search for tombstones
|
||||
let ts = match self.internal_search(
|
||||
au,
|
||||
Filter::Eq("class".to_string(), "tombstone".to_string())
|
||||
) {
|
||||
Ok(r) => {
|
||||
r
|
||||
}
|
||||
Err(e) => {
|
||||
return Err(e)
|
||||
}
|
||||
let ts = match self
|
||||
.internal_search(au, Filter::Eq("class".to_string(), "tombstone".to_string()))
|
||||
{
|
||||
Ok(r) => r,
|
||||
Err(e) => return Err(e),
|
||||
};
|
||||
|
||||
// TODO: Has an appropriate amount of time/condition past (ie replication events?)
|
||||
|
@ -475,23 +470,16 @@ impl<'a> QueryServerWriteTransaction<'a> {
|
|||
pub fn purge_recycled(&self, au: &mut AuditScope) -> Result<(), OperationError> {
|
||||
// Send everything that is recycled to tombstone
|
||||
// Search all recycled
|
||||
let rc = match self.internal_search(
|
||||
au,
|
||||
Filter::Eq("class".to_string(), "recycled".to_string())
|
||||
) {
|
||||
Ok(r) => {
|
||||
r
|
||||
}
|
||||
Err(e) => {
|
||||
return Err(e)
|
||||
}
|
||||
let rc = match self
|
||||
.internal_search(au, Filter::Eq("class".to_string(), "recycled".to_string()))
|
||||
{
|
||||
Ok(r) => r,
|
||||
Err(e) => return Err(e),
|
||||
};
|
||||
|
||||
// Modify them to strip all avas except uuid
|
||||
|
||||
let tombstone_cand = rc.iter().map(|e| {
|
||||
e.to_tombstone()
|
||||
}).collect();
|
||||
let tombstone_cand = rc.iter().map(|e| e.to_tombstone()).collect();
|
||||
|
||||
// Backend Modify
|
||||
let mut audit_be = AuditScope::new("backend_modify");
|
||||
|
@ -518,7 +506,11 @@ impl<'a> QueryServerWriteTransaction<'a> {
|
|||
}
|
||||
|
||||
// Should this take a revive event?
|
||||
pub fn revive_recycled(&self, au: &mut AuditScope, re: &ReviveRecycledEvent) -> Result<(), OperationError> {
|
||||
pub fn revive_recycled(
|
||||
&self,
|
||||
au: &mut AuditScope,
|
||||
re: &ReviveRecycledEvent,
|
||||
) -> Result<(), OperationError> {
|
||||
// Revive an entry to live. This is a specialised (limited)
|
||||
// modify proxy.
|
||||
//
|
||||
|
@ -527,20 +519,13 @@ impl<'a> QueryServerWriteTransaction<'a> {
|
|||
|
||||
// create the modify
|
||||
// tl;dr, remove the class=recycled
|
||||
let modlist = ModifyList::new_list(vec![
|
||||
Modify::Removed(
|
||||
"class".to_string(),
|
||||
"recycled".to_string(),
|
||||
),
|
||||
]);
|
||||
let modlist = ModifyList::new_list(vec![Modify::Removed(
|
||||
"class".to_string(),
|
||||
"recycled".to_string(),
|
||||
)]);
|
||||
|
||||
// Now impersonate the modify
|
||||
self.impersonate_modify(
|
||||
au,
|
||||
re.filter.clone(),
|
||||
modlist
|
||||
)
|
||||
|
||||
self.impersonate_modify(au, re.filter.clone(), modlist)
|
||||
}
|
||||
|
||||
pub fn modify(&self, au: &mut AuditScope, me: &ModifyEvent) -> Result<(), OperationError> {
|
||||
|
@ -879,8 +864,6 @@ impl Actor for QueryServer {
|
|||
ctx.set_mailbox_capacity(1 << 31);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
// The server only recieves "Event" structures, which
|
||||
|
@ -1043,15 +1026,20 @@ mod tests {
|
|||
use super::super::be::{Backend, BackendTransaction};
|
||||
use super::super::entry::{Entry, EntryCommitted, EntryInvalid, EntryNew, EntryValid};
|
||||
use super::super::error::OperationError;
|
||||
use super::super::event::{CreateEvent, DeleteEvent, ModifyEvent, SearchEvent, ReviveRecycledEvent};
|
||||
use super::super::event::{
|
||||
CreateEvent, DeleteEvent, ModifyEvent, ReviveRecycledEvent, SearchEvent,
|
||||
};
|
||||
use super::super::filter::Filter;
|
||||
use super::super::log;
|
||||
use super::super::modify::{Modify, ModifyList};
|
||||
use super::super::proto_v1::Entry as ProtoEntry;
|
||||
use super::super::proto_v1::Filter as ProtoFilter;
|
||||
use super::super::proto_v1::{CreateRequest, SearchRequest, DeleteRequest, ModifyRequest, SearchRecycledRequest, ReviveRecycledRequest};
|
||||
use super::super::proto_v1::Modify as ProtoModify;
|
||||
use super::super::proto_v1::ModifyList as ProtoModifyList;
|
||||
use super::super::proto_v1::{
|
||||
CreateRequest, DeleteRequest, ModifyRequest, ReviveRecycledRequest, SearchRecycledRequest,
|
||||
SearchRequest,
|
||||
};
|
||||
use super::super::schema::Schema;
|
||||
use super::super::server::{
|
||||
QueryServer, QueryServerReadTransaction, QueryServerWriteTransaction,
|
||||
|
@ -1430,29 +1418,21 @@ mod tests {
|
|||
run_test!(|_log, mut server: QueryServer, audit: &mut AuditScope| {
|
||||
let mut server_txn = server.write();
|
||||
|
||||
let filt_ts = ProtoFilter::Eq(
|
||||
String::from("class"),
|
||||
String::from("tombstone")
|
||||
);
|
||||
let filt_ts = ProtoFilter::Eq(String::from("class"), String::from("tombstone"));
|
||||
|
||||
let filt_i_ts = Filter::Eq(
|
||||
String::from("class"),
|
||||
String::from("tombstone")
|
||||
);
|
||||
let filt_i_ts = Filter::Eq(String::from("class"), String::from("tombstone"));
|
||||
|
||||
// Create fake external requests. Probably from admin later
|
||||
let me_ts = ModifyEvent::from_request(
|
||||
ModifyRequest::new(
|
||||
filt_ts.clone(),
|
||||
ProtoModifyList::new_list(vec![
|
||||
ProtoModify::Present(String::from("class"), String::from("tombstone")),
|
||||
]),
|
||||
)
|
||||
);
|
||||
let me_ts = ModifyEvent::from_request(ModifyRequest::new(
|
||||
filt_ts.clone(),
|
||||
ProtoModifyList::new_list(vec![ProtoModify::Present(
|
||||
String::from("class"),
|
||||
String::from("tombstone"),
|
||||
)]),
|
||||
));
|
||||
let de_ts = DeleteEvent::from_request(DeleteRequest::new(filt_ts.clone()));
|
||||
let se_ts = SearchEvent::from_request(SearchRequest::new(filt_ts.clone()));
|
||||
|
||||
|
||||
// First, create a tombstone
|
||||
let e_ts: Entry<EntryInvalid, EntryNew> = serde_json::from_str(
|
||||
r#"{
|
||||
|
@ -1484,7 +1464,9 @@ mod tests {
|
|||
|
||||
// Can it be seen (internal search)
|
||||
// Internal search should see it.
|
||||
let r2 = server_txn.internal_search(audit, filt_i_ts.clone()).unwrap();
|
||||
let r2 = server_txn
|
||||
.internal_search(audit, filt_i_ts.clone())
|
||||
.unwrap();
|
||||
assert!(r2.len() == 1);
|
||||
|
||||
// Now purge
|
||||
|
@ -1505,52 +1487,30 @@ mod tests {
|
|||
run_test!(|_log, mut server: QueryServer, audit: &mut AuditScope| {
|
||||
let mut server_txn = server.write();
|
||||
|
||||
let filt_rc = ProtoFilter::Eq(
|
||||
String::from("class"),
|
||||
String::from("recycled")
|
||||
);
|
||||
let filt_rc = ProtoFilter::Eq(String::from("class"), String::from("recycled"));
|
||||
|
||||
let filt_i_rc = Filter::Eq(
|
||||
String::from("class"),
|
||||
String::from("recycled")
|
||||
);
|
||||
let filt_i_rc = Filter::Eq(String::from("class"), String::from("recycled"));
|
||||
|
||||
let filt_i_ts = Filter::Eq(
|
||||
String::from("class"),
|
||||
String::from("tombstone")
|
||||
);
|
||||
let filt_i_ts = Filter::Eq(String::from("class"), String::from("tombstone"));
|
||||
|
||||
let filt_i_per = Filter::Eq(
|
||||
String::from("class"),
|
||||
String::from("person")
|
||||
);
|
||||
let filt_i_per = Filter::Eq(String::from("class"), String::from("person"));
|
||||
|
||||
// Create fake external requests. Probably from admin later
|
||||
let me_rc = ModifyEvent::from_request(
|
||||
ModifyRequest::new(
|
||||
filt_rc.clone(),
|
||||
ProtoModifyList::new_list(vec![
|
||||
ProtoModify::Present(String::from("class"), String::from("recycled")),
|
||||
]),
|
||||
)
|
||||
);
|
||||
let me_rc = ModifyEvent::from_request(ModifyRequest::new(
|
||||
filt_rc.clone(),
|
||||
ProtoModifyList::new_list(vec![ProtoModify::Present(
|
||||
String::from("class"),
|
||||
String::from("recycled"),
|
||||
)]),
|
||||
));
|
||||
let de_rc = DeleteEvent::from_request(DeleteRequest::new(filt_rc.clone()));
|
||||
let se_rc = SearchEvent::from_request(SearchRequest::new(filt_rc.clone()));
|
||||
|
||||
let sre_rc = SearchEvent::from_rec_request(
|
||||
SearchRecycledRequest::new(
|
||||
filt_rc.clone()
|
||||
)
|
||||
);
|
||||
let sre_rc = SearchEvent::from_rec_request(SearchRecycledRequest::new(filt_rc.clone()));
|
||||
|
||||
let rre_rc = ReviveRecycledEvent::from_request(
|
||||
ReviveRecycledRequest::new(
|
||||
ProtoFilter::Eq(
|
||||
"name".to_string(),
|
||||
"testperson1".to_string(),
|
||||
)
|
||||
)
|
||||
);
|
||||
let rre_rc = ReviveRecycledEvent::from_request(ReviveRecycledRequest::new(
|
||||
ProtoFilter::Eq("name".to_string(), "testperson1".to_string()),
|
||||
));
|
||||
|
||||
// Create some recycled objects
|
||||
let e1: Entry<EntryInvalid, EntryNew> = serde_json::from_str(
|
||||
|
@ -1583,7 +1543,6 @@ mod tests {
|
|||
)
|
||||
.unwrap();
|
||||
|
||||
|
||||
let ce = CreateEvent::from_vec(vec![e1, e2]);
|
||||
let cr = server_txn.create(audit, &ce);
|
||||
assert!(cr.is_ok());
|
||||
|
@ -1606,7 +1565,9 @@ mod tests {
|
|||
|
||||
// Can it be seen (internal search)
|
||||
// Internal search should see it.
|
||||
let r2 = server_txn.internal_search(audit, filt_i_rc.clone()).unwrap();
|
||||
let r2 = server_txn
|
||||
.internal_search(audit, filt_i_rc.clone())
|
||||
.unwrap();
|
||||
assert!(r2.len() == 2);
|
||||
|
||||
// There are now two options
|
||||
|
@ -1617,15 +1578,21 @@ mod tests {
|
|||
assert!(server_txn.purge_recycled(audit).is_ok());
|
||||
|
||||
// Should be no recycled objects.
|
||||
let r3 = server_txn.internal_search(audit, filt_i_rc.clone()).unwrap();
|
||||
let r3 = server_txn
|
||||
.internal_search(audit, filt_i_rc.clone())
|
||||
.unwrap();
|
||||
assert!(r3.len() == 0);
|
||||
|
||||
// There should be one tombstone
|
||||
let r4 = server_txn.internal_search(audit, filt_i_ts.clone()).unwrap();
|
||||
let r4 = server_txn
|
||||
.internal_search(audit, filt_i_ts.clone())
|
||||
.unwrap();
|
||||
assert!(r4.len() == 1);
|
||||
|
||||
// There should be one entry
|
||||
let r5 = server_txn.internal_search(audit, filt_i_per.clone()).unwrap();
|
||||
let r5 = server_txn
|
||||
.internal_search(audit, filt_i_per.clone())
|
||||
.unwrap();
|
||||
assert!(r5.len() == 1);
|
||||
|
||||
assert!(server_txn.commit(audit).is_ok());
|
||||
|
|
Loading…
Reference in a new issue