From 4ac162cf15213b6cc1536ecfabc0a53fbc86e7f4 Mon Sep 17 00:00:00 2001 From: alphaeusmote <41258468-alphaeusmote@users.noreply.replit.com> Date: Thu, 10 Apr 2025 16:03:46 +0000 Subject: [PATCH] Add separate options to automatically create groups and OUs for each distinct attribute value. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 705f2157-ef97-4fbd-89e4-8c7f2ecaea90 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7ed01c5f-a82d-405a-b728-b2e3d127c60c/a06c36a2-1af0-4ff3-ae4b-fb7a1884703d.jpg --- .../components/dynamic-groups/rule-editor.tsx | 44 ++++++++++++++++--- shared/schema.ts | 1 + 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/client/src/components/dynamic-groups/rule-editor.tsx b/client/src/components/dynamic-groups/rule-editor.tsx index 00856d7..d862eb7 100644 --- a/client/src/components/dynamic-groups/rule-editor.tsx +++ b/client/src/components/dynamic-groups/rule-editor.tsx @@ -52,14 +52,27 @@ export const RuleEditor: React.FC = ({ rule, onSave, onCancel } const [activeTab, setActiveTab] = useState('general'); const [conditions, setConditions] = useState([]); const [schedules, setSchedules] = useState([]); - const [formData, setFormData] = useState({ + const [formData, setFormData] = useState<{ + name: string; + description: string; + targetGroupName: string; + targetOU: string; + createGroupIfNotExists: boolean; + createOUIfNotExists: boolean; + createGroupForEachAttributeValue: boolean; + createOUForEachAttributeValue: boolean; + enabled: boolean; + variablePattern: string; + connections: number[]; + }>({ name: rule?.name || '', description: rule?.description || '', targetGroupName: rule?.targetGroup ? rule?.targetGroup.split(',')[0].replace('CN=', '') : '', targetOU: rule?.targetGroup ? rule?.targetGroup.split(',').slice(1).join(',') : '', createGroupIfNotExists: rule?.createGroupIfNotExists || false, - createOUIfNotExists: false, - createGroupForEachAttributeValue: false, + createOUIfNotExists: rule?.createOUIfNotExists || false, + createGroupForEachAttributeValue: rule?.createGroupForEachAttributeValue || false, + createOUForEachAttributeValue: rule?.createOUForEachAttributeValue || false, enabled: rule?.enabled ?? true, variablePattern: rule?.variablePattern || '', connections: rule?.connectionIds || [] @@ -443,8 +456,23 @@ export const RuleEditor: React.FC = ({ rule, onSave, onCancel }

- When enabled, the system will automatically create separate groups for each distinct value - of the attribute variables used in the group name or OU + When enabled, the system will automatically create separate groups for each distinct attribute value + used in the group name variables +

+ +
+ handleToggleChange('createOUForEachAttributeValue', checked)} + /> + +
+

+ When enabled, the system will automatically create separate organizational units for each distinct attribute value + used in the OU path variables

@@ -542,6 +570,12 @@ export const RuleEditor: React.FC = ({ rule, onSave, onCancel } {formData.createGroupForEachAttributeValue ? 'Yes' : 'No'} +
+
Create OUs per attribute value:
+
+ {formData.createOUForEachAttributeValue ? 'Yes' : 'No'} +
+
Status:
diff --git a/shared/schema.ts b/shared/schema.ts index e171346..7d39e93 100644 --- a/shared/schema.ts +++ b/shared/schema.ts @@ -204,6 +204,7 @@ export const dynamicGroupRules = pgTable("dynamic_group_rules", { createGroupIfNotExists: boolean("create_group_if_not_exists").default(false), createOUIfNotExists: boolean("create_ou_if_not_exists").default(false), createGroupForEachAttributeValue: boolean("create_group_for_each_attribute_value").default(false), + createOUForEachAttributeValue: boolean("create_ou_for_each_attribute_value").default(false), }); // Rule conditions (filter logic)