Skip to content

Commit

Permalink
a try of a prop addition
Browse files Browse the repository at this point in the history
  • Loading branch information
dvv committed Mar 4, 2024
1 parent 1a81b43 commit 60285f0
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 3 deletions.
1 change: 1 addition & 0 deletions proto/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ pub const ATTR_NAME: &str = "name";
pub const ATTR_NO_INDEX: &str = "no-index";
pub const ATTR_NSACCOUNTLOCK: &str = "nsaccountlock";
pub const ATTR_NSUNIQUEID: &str = "nsuniqueid";
pub const ATTR_PROPS: &str = "props";

pub const ATTR_OAUTH2_ALLOW_INSECURE_CLIENT_DISABLE_PKCE: &str =
"oauth2_allow_insecure_client_disable_pkce";
Expand Down
11 changes: 9 additions & 2 deletions server/lib/src/constants/acp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,7 @@ lazy_static! {
Attribute::UserAuthTokenSession,
Attribute::PassKeys,
Attribute::AttestedPasskeys,
Attribute::Props,
],
..Default::default()
};
Expand Down Expand Up @@ -1441,6 +1442,7 @@ lazy_static! {
Attribute::Member,
Attribute::DynMember,
Attribute::EntryManagedBy,
Attribute::Props,
],
create_attrs: vec![
Attribute::Class,
Expand All @@ -1449,6 +1451,7 @@ lazy_static! {
Attribute::Description,
Attribute::Member,
Attribute::EntryManagedBy,
Attribute::Props,
],
create_classes: vec![
EntryClass::Object,
Expand All @@ -1458,11 +1461,13 @@ lazy_static! {
Attribute::Name,
Attribute::Description,
Attribute::Member,
Attribute::Props,
],
modify_removed_attrs: vec![
Attribute::Name,
Attribute::Description,
Attribute::Member,
Attribute::Props,
],
..Default::default()
};
Expand Down Expand Up @@ -1665,6 +1670,7 @@ lazy_static! {
Attribute::Mail,
Attribute::AccountExpire,
Attribute::AccountValidFrom,
Attribute::Props,
],
create_classes: vec![EntryClass::Object, EntryClass::Account, EntryClass::Person,],
..Default::default()
Expand All @@ -1687,8 +1693,8 @@ lazy_static! {
match_class_filter!(EntryClass::Account),
FILTER_ANDNOT_HP_OR_RECYCLED_OR_TOMBSTONE.clone(),
])),
modify_removed_attrs: vec![Attribute::AccountExpire, Attribute::AccountValidFrom,],
modify_present_attrs: vec![Attribute::AccountExpire, Attribute::AccountValidFrom,],
modify_removed_attrs: vec![Attribute::AccountExpire, Attribute::AccountValidFrom, Attribute::Props,],
modify_present_attrs: vec![Attribute::AccountExpire, Attribute::AccountValidFrom, Attribute::Props,],
..Default::default()
};
}
Expand Down Expand Up @@ -1724,6 +1730,7 @@ lazy_static! {
Attribute::Uuid,
Attribute::AccountExpire,
Attribute::AccountValidFrom,
Attribute::Props,
],
..Default::default()
};
Expand Down
3 changes: 3 additions & 0 deletions server/lib/src/constants/entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ pub enum Attribute {
PrimaryCredential,
PrivateCookieKey,
PrivilegeExpiry,
Props,
RadiusSecret,
RecycledDirectMemberOf,
Replicated,
Expand Down Expand Up @@ -335,6 +336,7 @@ impl TryFrom<String> for Attribute {
ATTR_PRIMARY_CREDENTIAL => Attribute::PrimaryCredential,
ATTR_PRIVATE_COOKIE_KEY => Attribute::PrivateCookieKey,
ATTR_PRIVILEGE_EXPIRY => Attribute::PrivilegeExpiry,
ATTR_PROPS => Attribute::Props,
ATTR_RADIUS_SECRET => Attribute::RadiusSecret,
ATTR_RECYCLEDDIRECTMEMBEROF => Attribute::RecycledDirectMemberOf,
ATTR_REPLICATED => Attribute::Replicated,
Expand Down Expand Up @@ -501,6 +503,7 @@ impl From<Attribute> for &'static str {
Attribute::PrimaryCredential => ATTR_PRIMARY_CREDENTIAL,
Attribute::PrivateCookieKey => ATTR_PRIVATE_COOKIE_KEY,
Attribute::PrivilegeExpiry => ATTR_PRIVILEGE_EXPIRY,
Attribute::Props => ATTR_PROPS,
Attribute::RadiusSecret => ATTR_RADIUS_SECRET,
Attribute::RecycledDirectMemberOf => ATTR_RECYCLEDDIRECTMEMBEROF,
Attribute::Replicated => ATTR_REPLICATED,
Expand Down
16 changes: 15 additions & 1 deletion server/lib/src/constants/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,15 @@ pub static ref SCHEMA_ATTR_LIMIT_SEARCH_MAX_FILTER_TEST_DL6: SchemaAttribute = S
..Default::default()
};

pub static ref SCHEMA_ATTR_PROPS: SchemaAttribute = SchemaAttribute {
uuid: UUID_SCHEMA_ATTR_PROPS,
name: Attribute::Props.into(),
description: "Custom properties of this object".to_string(),
sync_allowed: true,
syntax: SyntaxType::Utf8String,
..Default::default()
};

// === classes ===

pub static ref SCHEMA_CLASS_PERSON: SchemaClass = SchemaClass {
Expand Down Expand Up @@ -675,6 +684,7 @@ pub static ref SCHEMA_CLASS_PERSON_DL5: SchemaClass = SchemaClass {
Attribute::OAuth2Session.into(),
Attribute::Mail.into(),
Attribute::LegalName.into(),
Attribute::Props.into(),
],
systemmust: vec![
Attribute::IdVerificationEcKey.into()
Expand Down Expand Up @@ -708,7 +718,8 @@ pub static ref SCHEMA_CLASS_GROUP: SchemaClass = SchemaClass {
systemmay: vec![
Attribute::Member.into(),
Attribute::GrantUiHint.into(),
Attribute::Description.into()
Attribute::Description.into(),
Attribute::Props.into(),
],
systemmust: vec![
Attribute::Name.into(),
Expand Down Expand Up @@ -756,6 +767,7 @@ pub static ref SCHEMA_CLASS_ACCOUNT_POLICY_DL6: SchemaClass = SchemaClass {
Attribute::WebauthnAttestationCaList.into(),
Attribute::LimitSearchMaxResults.into(),
Attribute::LimitSearchMaxFilterTest.into(),
Attribute::Props.into(),
],
systemsupplements: vec![Attribute::Group.into()],
..Default::default()
Expand All @@ -782,6 +794,7 @@ pub static ref SCHEMA_CLASS_ACCOUNT: SchemaClass = SchemaClass {
Attribute::OAuth2Session.into(),
Attribute::Description.into(),
Attribute::NameHistory.into(),
Attribute::Props.into(),
],
systemmust: vec![
Attribute::DisplayName.into(),
Expand Down Expand Up @@ -873,6 +886,7 @@ pub static ref SCHEMA_CLASS_SERVICE_ACCOUNT_DL6: SchemaClass = SchemaClass {
Attribute::PrimaryCredential.into(),
Attribute::JwsEs256PrivateKey.into(),
Attribute::ApiTokenSession.into(),
Attribute::Props.into(),
],
systemexcludes: vec![EntryClass::Person.into()],
..Default::default()
Expand Down
1 change: 1 addition & 0 deletions server/lib/src/constants/uuids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ pub const UUID_SCHEMA_ATTR_LIMIT_SEARCH_MAX_RESULTS: Uuid =
uuid!("00000000-0000-0000-0000-ffff00000161");
pub const UUID_SCHEMA_ATTR_LIMIT_SEARCH_MAX_FILTER_TEST: Uuid =
uuid!("00000000-0000-0000-0000-ffff00000162");
pub const UUID_SCHEMA_ATTR_PROPS: Uuid = uuid!("00000000-0000-0000-0000-ffff00000163");

// System and domain infos
// I'd like to strongly criticise william of the past for making poor choices about these allocations.
Expand Down
7 changes: 7 additions & 0 deletions server/lib/src/server/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,9 @@ impl<'a> QueryServerWriteTransaction<'a> {
let idm_schema_classes = [
SCHEMA_ATTR_LIMIT_SEARCH_MAX_RESULTS_DL6.clone().into(),
SCHEMA_ATTR_LIMIT_SEARCH_MAX_FILTER_TEST_DL6.clone().into(),
SCHEMA_ATTR_PROPS.clone().into(),
SCHEMA_CLASS_GROUP.clone().into(),
SCHEMA_CLASS_ACCOUNT.clone().into(),
SCHEMA_CLASS_ACCOUNT_POLICY_DL6.clone().into(),
SCHEMA_CLASS_SERVICE_ACCOUNT_DL6.clone().into(),
];
Expand All @@ -885,6 +888,9 @@ impl<'a> QueryServerWriteTransaction<'a> {
IDM_ACP_GROUP_ACCOUNT_POLICY_MANAGE_DL6.clone().into(),
IDM_ACP_PEOPLE_CREATE_DL6.clone().into(),
IDM_ACP_GROUP_MANAGE_DL6.clone().into(),
IDM_ACP_SELF_READ_V1.clone().into(),
IDM_ACP_PEOPLE_MANAGE_V1.clone().into(),
IDM_ACP_PEOPLE_READ_V1.clone().into(),
];

idm_access_controls
Expand Down Expand Up @@ -988,6 +994,7 @@ impl<'a> QueryServerWriteTransaction<'a> {
SCHEMA_ATTR_PASSKEYS.clone().into(),
SCHEMA_ATTR_PRIMARY_CREDENTIAL.clone().into(),
SCHEMA_ATTR_PRIVATE_COOKIE_KEY.clone().into(),
SCHEMA_ATTR_PROPS.clone().into(),
SCHEMA_ATTR_RADIUS_SECRET.clone().into(),
SCHEMA_ATTR_RS256_PRIVATE_KEY_DER.clone().into(),
SCHEMA_ATTR_SSH_PUBLICKEY.clone().into(),
Expand Down

0 comments on commit 60285f0

Please sign in to comment.