kanidmd_lib/
lib.rs

1//! The Kanidmd server library. This implements all of the internal components of the server
2//! which is used to process authentication, store identities and enforce access controls.
3
4#![deny(warnings)]
5#![deny(deprecated)]
6#![recursion_limit = "512"]
7#![warn(unused_extern_crates)]
8// Enable some groups of clippy lints.
9#![deny(clippy::suspicious)]
10#![deny(clippy::perf)]
11// Specific lints to enforce.
12#![deny(clippy::todo)]
13#![deny(clippy::unimplemented)]
14#![deny(clippy::unwrap_used)]
15#![deny(clippy::expect_used)]
16#![deny(clippy::panic)]
17#![deny(clippy::await_holding_lock)]
18#![deny(clippy::needless_pass_by_value)]
19#![deny(clippy::trivially_copy_pass_by_ref)]
20#![deny(clippy::disallowed_types)]
21#![deny(clippy::manual_let_else)]
22#![deny(clippy::indexing_slicing)]
23#![allow(clippy::unreachable)]
24
25#[cfg(all(test, not(any(feature = "dhat-heap", target_os = "illumos"))))]
26#[global_allocator]
27static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
28
29#[cfg(all(test, feature = "dhat-heap"))]
30#[global_allocator]
31static ALLOC: dhat::Alloc = dhat::Alloc;
32
33#[macro_use]
34extern crate rusqlite;
35
36#[macro_use]
37extern crate tracing;
38#[macro_use]
39extern crate lazy_static;
40
41// #[macro_use]
42// extern crate sketching;
43
44// This has to be before 'be' so the import order works
45#[macro_use]
46pub mod macros;
47
48pub mod be;
49pub mod constants;
50pub mod credential;
51pub mod entry;
52pub mod event;
53pub mod filter;
54
55// If this module is ever made public outside of this crate, firstyear will be extremely sad.
56// This is *purely migration data*. Don't even think about using it in test cases for anything
57// else.
58pub(crate) mod migration_data;
59
60pub mod modify;
61pub mod time;
62pub(crate) mod utils;
63pub mod value;
64pub mod valueset;
65#[macro_use]
66mod plugins;
67pub mod idm;
68pub mod repl;
69pub mod schema;
70pub mod server;
71pub mod status;
72pub mod testkit;
73
74/// A prelude of imports that should be imported by all other Kanidm modules to
75/// help make imports cleaner.
76pub mod prelude {
77    pub use kanidm_proto::attribute::{AttrString, Attribute};
78    pub use kanidm_proto::constants::*;
79    pub use kanidm_proto::internal::{ConsistencyError, OperationError, PluginError, SchemaError};
80    pub use kanidm_proto::scim_v1::JsonValue;
81    pub use sketching::{
82        admin_debug, admin_error, admin_info, admin_warn, filter_error, filter_info, filter_trace,
83        filter_warn, perf_trace, request_error, request_info, request_trace, request_warn,
84        security_access, security_critical, security_debug, security_error, security_info,
85        tagged_event, EventTag,
86    };
87    pub use std::time::Duration;
88    pub use url::Url;
89    pub use uuid::{uuid, Uuid};
90
91    pub use crate::constants::*;
92    pub use crate::entry::{
93        Entry, EntryCommitted, EntryIncrementalCommitted, EntryIncrementalNew, EntryInit,
94        EntryInitNew, EntryInvalid, EntryInvalidCommitted, EntryInvalidNew, EntryNew, EntryReduced,
95        EntryReducedCommitted, EntryRefresh, EntryRefreshNew, EntrySealed, EntrySealedCommitted,
96        EntrySealedNew, EntryTuple, EntryValid,
97    };
98    pub use crate::event::{CreateEvent, DeleteEvent, ExistsEvent, ModifyEvent, SearchEvent};
99    pub use crate::filter::{
100        f_and, f_andnot, f_eq, f_gt, f_id, f_inc, f_invalid, f_lt, f_or, f_pres, f_self,
101        f_spn_name, f_sub, Filter, FilterInvalid, FilterValid, FC,
102    };
103    pub use crate::idm::authentication::{ClientAuthInfo, ClientCertInfo};
104    pub use crate::idm::server::{IdmServer, IdmServerAudit, IdmServerDelayed};
105    pub use crate::modify::{
106        m_assert, m_pres, m_purge, m_remove, Modify, ModifyInvalid, ModifyList, ModifyValid,
107    };
108    pub use crate::repl::cid::Cid;
109    pub use crate::server::access::AccessControlsTransaction;
110    pub use crate::server::batch_modify::BatchModifyEvent;
111    pub use crate::server::identity::{
112        AccessScope, IdentType, IdentUser, Identity, IdentityId, Source,
113    };
114    pub use crate::server::{
115        QueryServer, QueryServerReadTransaction, QueryServerTransaction,
116        QueryServerWriteTransaction,
117    };
118    pub use crate::time::duration_from_epoch_now;
119    pub use crate::value::{
120        ApiTokenScope, IndexType, PartialValue, SessionScope, SyntaxType, Value,
121    };
122
123    pub use time::format_description::well_known::Rfc3339;
124
125    #[cfg(test)]
126    pub use kanidmd_lib_macros::*;
127
128    pub(crate) use crate::valueset::{
129        ValueSet, ValueSetBool, ValueSetCid, ValueSetIutf8, ValueSetRefer, ValueSetSyntax,
130        ValueSetT, ValueSetUtf8, ValueSetUuid,
131    };
132
133    pub(crate) use kanidm_proto::scim_v1::{
134        server::{ScimEntryKanidm, ScimValueKanidm},
135        ScimEntryHeader,
136    };
137
138    pub(crate) use crate::be::Limits;
139}