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