diff --git a/app/src/components/fragments/attribute_schema.rs b/app/src/components/fragments/attribute_schema.rs
new file mode 100644
index 0000000..7bc3ace
--- /dev/null
+++ b/app/src/components/fragments/attribute_schema.rs
@@ -0,0 +1,36 @@
+use yew::{html, Html};
+
+use crate::infra::attributes::AttributeDescription;
+
+pub fn render_attribute_name(
+ hardcoded: bool,
+ attribute_identifier: &String,
+ attribute_description: &AttributeDescription,
+) -> Html {
+ if hardcoded {
+ html! {
+ <>
+ {&attribute_description.attribute_name}
+ {
+ if attribute_description.aliases.is_empty() {
+ html!{}
+ } else {
+ html!{
+ <>
+
+
+ {"Aliases: "}
+ {attribute_description.aliases.join(", ")}
+
+ >
+ }
+ }
+ }
+ >
+ }
+ } else {
+ html! {
+ {&attribute_identifier}
+ }
+ }
+}
diff --git a/app/src/components/fragments/mod.rs b/app/src/components/fragments/mod.rs
new file mode 100644
index 0000000..1062d88
--- /dev/null
+++ b/app/src/components/fragments/mod.rs
@@ -0,0 +1 @@
+pub mod attribute_schema;
diff --git a/app/src/components/group_schema_table.rs b/app/src/components/group_schema_table.rs
index 0a6a4f7..7481253 100644
--- a/app/src/components/group_schema_table.rs
+++ b/app/src/components/group_schema_table.rs
@@ -1,10 +1,12 @@
use crate::{
components::{
delete_group_attribute::DeleteGroupAttribute,
+ fragments::attribute_schema::render_attribute_name,
router::{AppRoute, Link},
},
convert_attribute_type,
infra::{
+ attributes::group,
common_component::{CommonComponent, CommonComponentParts},
schema::AttributeType,
},
@@ -152,9 +154,10 @@ impl GroupSchemaTable {
};
let hardcoded = ctx.props().hardcoded;
+ let desc = group::resolve_group_attribute_description_or_default(&attribute.name);
html! {
- | {&attribute.name} |
+ {render_attribute_name(hardcoded, &attribute.name, &desc)} |
{if attribute.is_list { format!("List<{attribute_type}>")} else {attribute_type.to_string()}} |
{if attribute.is_visible {checkmark.clone()} else {html!{}}} |
{
diff --git a/app/src/components/mod.rs b/app/src/components/mod.rs
index 9c09161..554516b 100644
--- a/app/src/components/mod.rs
+++ b/app/src/components/mod.rs
@@ -13,6 +13,7 @@ pub mod delete_group_attribute;
pub mod delete_user;
pub mod delete_user_attribute;
pub mod form;
+pub mod fragments;
pub mod group_details;
pub mod group_details_form;
pub mod group_schema_table;
diff --git a/app/src/components/user_schema_table.rs b/app/src/components/user_schema_table.rs
index 45e4446..2e76cc0 100644
--- a/app/src/components/user_schema_table.rs
+++ b/app/src/components/user_schema_table.rs
@@ -1,10 +1,12 @@
use crate::{
components::{
delete_user_attribute::DeleteUserAttribute,
+ fragments::attribute_schema::render_attribute_name,
router::{AppRoute, Link},
},
convert_attribute_type,
infra::{
+ attributes::user,
common_component::{CommonComponent, CommonComponentParts},
schema::AttributeType,
},
@@ -151,9 +153,10 @@ impl UserSchemaTable {
};
let hardcoded = ctx.props().hardcoded;
+ let desc = user::resolve_user_attribute_description_or_default(&attribute.name);
html! {
- | {&attribute.name} |
+ {render_attribute_name(hardcoded, &attribute.name, &desc)} |
{if attribute.is_list { format!("List<{attribute_type}>")} else {attribute_type.to_string()}} |
{if attribute.is_editable {checkmark.clone()} else {html!{}}} |
{if attribute.is_visible {checkmark.clone()} else {html!{}}} |
diff --git a/app/src/infra/attributes.rs b/app/src/infra/attributes.rs
new file mode 100644
index 0000000..dbddeee
--- /dev/null
+++ b/app/src/infra/attributes.rs
@@ -0,0 +1,109 @@
+pub struct AttributeDescription<'a> {
+ pub attribute_identifier: &'a str,
+ pub attribute_name: &'a str,
+ pub aliases: Vec<&'a str>,
+}
+
+pub mod group {
+
+ use super::AttributeDescription;
+
+ pub fn resolve_group_attribute_description(name: &str) -> Option {
+ match name {
+ "creation_date" => Some(AttributeDescription {
+ attribute_identifier: name,
+ attribute_name: "creationdate",
+ aliases: vec![name, "createtimestamp", "modifytimestamp"],
+ }),
+ "display_name" => Some(AttributeDescription {
+ attribute_identifier: name,
+ attribute_name: "displayname",
+ aliases: vec![name, "cn", "uid", "id"],
+ }),
+ "group_id" => Some(AttributeDescription {
+ attribute_identifier: name,
+ attribute_name: "groupid",
+ aliases: vec![name],
+ }),
+ "uuid" => Some(AttributeDescription {
+ attribute_identifier: name,
+ attribute_name: name,
+ aliases: vec!["entryuuid"],
+ }),
+ _ => None,
+ }
+ }
+
+ pub fn resolve_group_attribute_description_or_default(name: &str) -> AttributeDescription {
+ match resolve_group_attribute_description(name) {
+ Some(d) => d,
+ None => AttributeDescription {
+ attribute_identifier: name,
+ attribute_name: name,
+ aliases: vec![],
+ },
+ }
+ }
+}
+
+pub mod user {
+
+ use super::AttributeDescription;
+
+ pub fn resolve_user_attribute_description(name: &str) -> Option {
+ match name {
+ "avatar" => Some(AttributeDescription {
+ attribute_identifier: name,
+ attribute_name: name,
+ aliases: vec!["jpegphoto"],
+ }),
+ "creation_date" => Some(AttributeDescription {
+ attribute_identifier: name,
+ attribute_name: "creationdate",
+ aliases: vec![name, "createtimestamp", "modifytimestamp"],
+ }),
+ "display_name" => Some(AttributeDescription {
+ attribute_identifier: name,
+ attribute_name: "displayname",
+ aliases: vec![name, "cn"],
+ }),
+ "first_name" => Some(AttributeDescription {
+ attribute_identifier: name,
+ attribute_name: "firstname",
+ aliases: vec![name, "givenname"],
+ }),
+ "last_name" => Some(AttributeDescription {
+ attribute_identifier: name,
+ attribute_name: "lastname",
+ aliases: vec![name, "sn"],
+ }),
+ "mail" => Some(AttributeDescription {
+ attribute_identifier: name,
+ attribute_name: name,
+ aliases: vec!["email"],
+ }),
+ "user_id" => Some(AttributeDescription {
+ attribute_identifier: name,
+ attribute_name: "uid",
+ aliases: vec![name, "id"],
+ }),
+ "uuid" => Some(AttributeDescription {
+ attribute_identifier: name,
+ attribute_name: name,
+ aliases: vec!["entryuuid"],
+ }),
+ _ => None,
+ }
+ }
+
+ pub fn resolve_user_attribute_description_or_default(name: &str) -> AttributeDescription {
+ match resolve_user_attribute_description(name) {
+ Some(d) => d,
+ None => AttributeDescription {
+ attribute_identifier: name,
+ attribute_name: name,
+ aliases: vec![],
+ },
+ }
+ }
+}
diff --git a/app/src/infra/mod.rs b/app/src/infra/mod.rs
index dc0d8a4..028f611 100644
--- a/app/src/infra/mod.rs
+++ b/app/src/infra/mod.rs
@@ -1,4 +1,5 @@
pub mod api;
+pub mod attributes;
pub mod common_component;
pub mod cookies;
pub mod form_utils;