Skip to main content

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