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)