mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 04:27:02 +01:00
Fixing up build for rust 1.78, hiding things behind cfg(test) etc. (#2753)
* fixing up build for rust 1.78, hiding things behind cfg(test) etc. * cleaning up version identifier handling in book gen
This commit is contained in:
parent
a67d1f5160
commit
aefcdc5ee8
2
.github/workflows/kanidm_book.yml
vendored
2
.github/workflows/kanidm_book.yml
vendored
|
@ -41,6 +41,8 @@ jobs:
|
|||
| awk '{print $1}' \
|
||||
| sort -t. -k3n,3 -k4n,4 \
|
||||
| awk -F'/' '{print $NF}' \
|
||||
| grep -E '^[[:digit:]]\.[[:digit:]]\.[[:digit:]]' \
|
||||
| sort -t. \
|
||||
| tail -n1)" >> $GITHUB_OUTPUT
|
||||
id: branchname
|
||||
- name: Move redirector page
|
||||
|
|
|
@ -149,16 +149,16 @@ macro_rules! get_identry_raw {
|
|||
}};
|
||||
}
|
||||
|
||||
macro_rules! exists_idx {
|
||||
(
|
||||
$self:expr,
|
||||
$attr:expr,
|
||||
$itype:expr
|
||||
) => {{
|
||||
// As a cache we have no concept of this, so we just bypass to the db.
|
||||
$self.db.exists_idx($attr, $itype)
|
||||
}};
|
||||
}
|
||||
// macro_rules! exists_idx {
|
||||
// (
|
||||
// $self:expr,
|
||||
// $attr:expr,
|
||||
// $itype:expr
|
||||
// ) => {{
|
||||
// // As a cache we have no concept of this, so we just bypass to the db.
|
||||
// $self.db.exists_idx($attr, $itype)
|
||||
// }};
|
||||
// }
|
||||
|
||||
macro_rules! get_idl {
|
||||
(
|
||||
|
@ -342,7 +342,7 @@ pub trait IdlArcSqliteTransaction {
|
|||
|
||||
fn get_identry_raw(&self, idl: &IdList) -> Result<Vec<IdRawEntry>, OperationError>;
|
||||
|
||||
fn exists_idx(&mut self, attr: &str, itype: IndexType) -> Result<bool, OperationError>;
|
||||
// fn exists_idx(&mut self, attr: &str, itype: IndexType) -> Result<bool, OperationError>;
|
||||
|
||||
fn get_idl(
|
||||
&mut self,
|
||||
|
@ -397,9 +397,9 @@ impl<'a> IdlArcSqliteTransaction for IdlArcSqliteReadTransaction<'a> {
|
|||
get_identry_raw!(self, idl)
|
||||
}
|
||||
|
||||
fn exists_idx(&mut self, attr: &str, itype: IndexType) -> Result<bool, OperationError> {
|
||||
exists_idx!(self, attr, itype)
|
||||
}
|
||||
// fn exists_idx(&mut self, attr: &str, itype: IndexType) -> Result<bool, OperationError> {
|
||||
// exists_idx!(self, attr, itype)
|
||||
// }
|
||||
|
||||
#[instrument(level = "trace", skip_all)]
|
||||
fn get_idl(
|
||||
|
@ -492,9 +492,9 @@ impl<'a> IdlArcSqliteTransaction for IdlArcSqliteWriteTransaction<'a> {
|
|||
get_identry_raw!(self, idl)
|
||||
}
|
||||
|
||||
fn exists_idx(&mut self, attr: &str, itype: IndexType) -> Result<bool, OperationError> {
|
||||
exists_idx!(self, attr, itype)
|
||||
}
|
||||
// fn exists_idx(&mut self, attr: &str, itype: IndexType) -> Result<bool, OperationError> {
|
||||
// exists_idx!(self, attr, itype)
|
||||
// }
|
||||
|
||||
#[instrument(level = "trace", skip_all)]
|
||||
fn get_idl(
|
||||
|
|
|
@ -163,17 +163,17 @@ trait Plugin {
|
|||
Err(OperationError::InvalidState)
|
||||
}
|
||||
|
||||
fn pre_repl_incremental(
|
||||
_qs: &mut QueryServerWriteTransaction,
|
||||
_cand: &mut [(EntryIncrementalCommitted, Arc<EntrySealedCommitted>)],
|
||||
) -> Result<(), OperationError> {
|
||||
admin_error!(
|
||||
"plugin {} has an unimplemented pre_repl_incremental!",
|
||||
Self::id()
|
||||
);
|
||||
debug_assert!(false);
|
||||
Err(OperationError::InvalidState)
|
||||
}
|
||||
// fn pre_repl_incremental(
|
||||
// _qs: &mut QueryServerWriteTransaction,
|
||||
// _cand: &mut [(EntryIncrementalCommitted, Arc<EntrySealedCommitted>)],
|
||||
// ) -> Result<(), OperationError> {
|
||||
// admin_error!(
|
||||
// "plugin {} has an unimplemented pre_repl_incremental!",
|
||||
// Self::id()
|
||||
// );
|
||||
// debug_assert!(false);
|
||||
// Err(OperationError::InvalidState)
|
||||
// }
|
||||
|
||||
fn post_repl_incremental_conflict(
|
||||
_qs: &mut QueryServerWriteTransaction,
|
||||
|
|
|
@ -6,6 +6,9 @@ use std::collections::BTreeSet;
|
|||
use uuid::Uuid;
|
||||
|
||||
pub type KeyObject = Box<dyn KeyObjectT + Send + Sync + 'static>;
|
||||
|
||||
// currently only used in testing, so no need to to exist until then
|
||||
#[cfg(test)]
|
||||
pub type KeyObjectRef<'a> = &'a (dyn KeyObjectT + Send + Sync + 'static);
|
||||
|
||||
pub trait KeyObjectT {
|
||||
|
|
|
@ -9,7 +9,10 @@ use std::ops::Deref;
|
|||
use std::sync::Arc;
|
||||
|
||||
use super::internal::KeyProviderInternal;
|
||||
use super::object::{KeyObject, KeyObjectRef};
|
||||
use super::object::KeyObject;
|
||||
|
||||
#[cfg(test)]
|
||||
use super::object::KeyObjectRef;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum KeyProvider {
|
||||
|
@ -119,8 +122,10 @@ impl KeyProviders {
|
|||
}
|
||||
|
||||
pub trait KeyProvidersTransaction {
|
||||
#[cfg(test)]
|
||||
fn get_uuid(&self, key_provider_uuid: Uuid) -> Option<&KeyProvider>;
|
||||
|
||||
#[cfg(test)]
|
||||
fn get_key_object(&self, key_object_uuid: Uuid) -> Option<KeyObjectRef>;
|
||||
|
||||
fn get_key_object_handle(&self, key_object_uuid: Uuid) -> Option<Arc<KeyObject>>;
|
||||
|
@ -131,6 +136,7 @@ pub struct KeyProvidersReadTransaction {
|
|||
}
|
||||
|
||||
impl KeyProvidersTransaction for KeyProvidersReadTransaction {
|
||||
#[cfg(test)]
|
||||
fn get_uuid(&self, key_provider_uuid: Uuid) -> Option<&KeyProvider> {
|
||||
self.inner
|
||||
.deref()
|
||||
|
@ -139,6 +145,7 @@ impl KeyProvidersTransaction for KeyProvidersReadTransaction {
|
|||
.map(|k| k.as_ref())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn get_key_object(&self, key_object_uuid: Uuid) -> Option<KeyObjectRef> {
|
||||
self.inner
|
||||
.deref()
|
||||
|
@ -161,6 +168,7 @@ pub struct KeyProvidersWriteTransaction<'a> {
|
|||
}
|
||||
|
||||
impl<'a> KeyProvidersTransaction for KeyProvidersWriteTransaction<'a> {
|
||||
#[cfg(test)]
|
||||
fn get_uuid(&self, key_provider_uuid: Uuid) -> Option<&KeyProvider> {
|
||||
self.inner
|
||||
.deref()
|
||||
|
@ -169,6 +177,7 @@ impl<'a> KeyProvidersTransaction for KeyProvidersWriteTransaction<'a> {
|
|||
.map(|k| k.as_ref())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn get_key_object(&self, key_object_uuid: Uuid) -> Option<KeyObjectRef> {
|
||||
self.inner
|
||||
.deref()
|
||||
|
|
|
@ -12,11 +12,11 @@ use std::collections::BTreeSet;
|
|||
|
||||
const PEOPLE_PREFIX: &str = "person";
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct PartialGroup {
|
||||
pub name: String,
|
||||
pub members: BTreeSet<String>,
|
||||
}
|
||||
// #[derive(Debug)]
|
||||
// pub struct PartialGroup {
|
||||
// pub name: String,
|
||||
// pub members: BTreeSet<String>,
|
||||
// }
|
||||
|
||||
fn random_name(prefix: &str, rng: &mut ChaCha8Rng) -> String {
|
||||
let suffix = Alphanumeric.sample_string(rng, 8).to_lowercase();
|
||||
|
|
Loading…
Reference in a new issue