diff --git a/client/src/components/dynamic-groups/rule-editor.tsx b/client/src/components/dynamic-groups/rule-editor.tsx index 3b0d984..00856d7 100644 --- a/client/src/components/dynamic-groups/rule-editor.tsx +++ b/client/src/components/dynamic-groups/rule-editor.tsx @@ -57,7 +57,9 @@ export const RuleEditor: React.FC = ({ rule, onSave, onCancel } description: rule?.description || '', targetGroupName: rule?.targetGroup ? rule?.targetGroup.split(',')[0].replace('CN=', '') : '', targetOU: rule?.targetGroup ? rule?.targetGroup.split(',').slice(1).join(',') : '', - createGroupIfNotExists: false, + createGroupIfNotExists: rule?.createGroupIfNotExists || false, + createOUIfNotExists: false, + createGroupForEachAttributeValue: false, enabled: rule?.enabled ?? true, variablePattern: rule?.variablePattern || '', connections: rule?.connectionIds || [] @@ -194,7 +196,9 @@ export const RuleEditor: React.FC = ({ rule, onSave, onCancel } lastRunStatus: rule?.lastRunStatus || null, variablePattern: formData.variablePattern || null, connectionIds: formData.connections, - createGroupIfNotExists: formData.createGroupIfNotExists + createGroupIfNotExists: formData.createGroupIfNotExists, + createOUIfNotExists: formData.createOUIfNotExists, + createGroupForEachAttributeValue: formData.createGroupForEachAttributeValue }; onSave(ruleData, schedules); @@ -210,7 +214,9 @@ export const RuleEditor: React.FC = ({ rule, onSave, onCancel } targetGroup: targetGroupDN, connectionIds: formData.connections, variablePattern: formData.variablePattern || null, - createGroupIfNotExists: formData.createGroupIfNotExists + createGroupIfNotExists: formData.createGroupIfNotExists, + createOUIfNotExists: formData.createOUIfNotExists, + createGroupForEachAttributeValue: formData.createGroupForEachAttributeValue }, conditions }); @@ -345,7 +351,44 @@ export const RuleEditor: React.FC = ({ rule, onSave, onCancel }

Target AD Group

-
+
+
+ +
+ +
+ { + const variableText = `{${variable}}`; + const currentValue = formData.targetOU || ''; + const newValue = currentValue + variableText; + setFormData({ ...formData, targetOU: newValue }); + }} + connections={formData.connections} + /> +
+
+

+ The OU where the group belongs (can include variables like {'{attributeName}'}) +

+
+ +
+ handleToggleChange('createOUIfNotExists', checked)} + /> + +
+
@@ -377,42 +420,31 @@ export const RuleEditor: React.FC = ({ rule, onSave, onCancel }

-
- - + handleToggleChange('createGroupIfNotExists', checked)} /> -

- The OU where the group belongs -

+
-
- handleToggleChange('createGroupIfNotExists', checked)} - /> - -
- -
- - +
+

Advanced Options

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

- Optional pattern for generating variable values in name or description. - Use {attributeName} to insert attribute values. + When enabled, the system will automatically create separate groups for each distinct value + of the attribute variables used in the group name or OU

@@ -493,11 +525,23 @@ export const RuleEditor: React.FC = ({ rule, onSave, onCancel }
-
Create if not exists:
+
Create group if not exists:
{formData.createGroupIfNotExists ? 'Yes' : 'No'}
+
+
Create OU if not exists:
+
+ {formData.createOUIfNotExists ? 'Yes' : 'No'} +
+
+
+
Create groups per attribute value:
+
+ {formData.createGroupForEachAttributeValue ? 'Yes' : 'No'} +
+
Status:
diff --git a/shared/schema.ts b/shared/schema.ts index 36c4796..e171346 100644 --- a/shared/schema.ts +++ b/shared/schema.ts @@ -201,6 +201,9 @@ export const dynamicGroupRules = pgTable("dynamic_group_rules", { lastRunStatus: text("last_run_status"), variablePattern: text("variable_pattern"), // Pattern for dynamic group name, e.g. "{{department}}-Users" useAdvancedScheduling: boolean("use_advanced_scheduling").default(false), + 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), }); // Rule conditions (filter logic)