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
This commit is contained in:
alphaeusmote
2025-04-10 16:03:46 +00:00
parent f6b55ca728
commit 4ac162cf15
2 changed files with 40 additions and 5 deletions
@@ -52,14 +52,27 @@ export const RuleEditor: React.FC<RuleEditorProps> = ({ rule, onSave, onCancel }
const [activeTab, setActiveTab] = useState('general');
const [conditions, setConditions] = useState<Condition[]>([]);
const [schedules, setSchedules] = useState<ScheduleItem[]>([]);
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<RuleEditorProps> = ({ rule, onSave, onCancel }
</Label>
</div>
<p className="text-xs text-muted-foreground">
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
</p>
<div className="flex items-center space-x-2 mt-4">
<Switch
id="createOUForEachAttributeValue"
checked={formData.createOUForEachAttributeValue}
onCheckedChange={(checked) => handleToggleChange('createOUForEachAttributeValue', checked)}
/>
<Label htmlFor="createOUForEachAttributeValue">
Automatically create OUs for each distinct attribute value
</Label>
</div>
<p className="text-xs text-muted-foreground">
When enabled, the system will automatically create separate organizational units for each distinct attribute value
used in the OU path variables
</p>
</div>
@@ -542,6 +570,12 @@ export const RuleEditor: React.FC<RuleEditorProps> = ({ rule, onSave, onCancel }
{formData.createGroupForEachAttributeValue ? 'Yes' : 'No'}
</dd>
</div>
<div className="flex justify-between">
<dt className="text-sm font-medium text-muted-foreground">Create OUs per attribute value:</dt>
<dd className="text-sm">
{formData.createOUForEachAttributeValue ? 'Yes' : 'No'}
</dd>
</div>
<div className="flex justify-between">
<dt className="text-sm font-medium text-muted-foreground">Status:</dt>
<dd className="text-sm">
+1
View File
@@ -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)