mirror of
https://github.com/freedbygrace/ActiveDirectoryManager.git
synced 2026-08-21 15:47:41 +00:00
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:
@@ -52,14 +52,27 @@ export const RuleEditor: React.FC<RuleEditorProps> = ({ rule, onSave, onCancel }
|
|||||||
const [activeTab, setActiveTab] = useState('general');
|
const [activeTab, setActiveTab] = useState('general');
|
||||||
const [conditions, setConditions] = useState<Condition[]>([]);
|
const [conditions, setConditions] = useState<Condition[]>([]);
|
||||||
const [schedules, setSchedules] = useState<ScheduleItem[]>([]);
|
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 || '',
|
name: rule?.name || '',
|
||||||
description: rule?.description || '',
|
description: rule?.description || '',
|
||||||
targetGroupName: rule?.targetGroup ? rule?.targetGroup.split(',')[0].replace('CN=', '') : '',
|
targetGroupName: rule?.targetGroup ? rule?.targetGroup.split(',')[0].replace('CN=', '') : '',
|
||||||
targetOU: rule?.targetGroup ? rule?.targetGroup.split(',').slice(1).join(',') : '',
|
targetOU: rule?.targetGroup ? rule?.targetGroup.split(',').slice(1).join(',') : '',
|
||||||
createGroupIfNotExists: rule?.createGroupIfNotExists || false,
|
createGroupIfNotExists: rule?.createGroupIfNotExists || false,
|
||||||
createOUIfNotExists: false,
|
createOUIfNotExists: rule?.createOUIfNotExists || false,
|
||||||
createGroupForEachAttributeValue: false,
|
createGroupForEachAttributeValue: rule?.createGroupForEachAttributeValue || false,
|
||||||
|
createOUForEachAttributeValue: rule?.createOUForEachAttributeValue || false,
|
||||||
enabled: rule?.enabled ?? true,
|
enabled: rule?.enabled ?? true,
|
||||||
variablePattern: rule?.variablePattern || '',
|
variablePattern: rule?.variablePattern || '',
|
||||||
connections: rule?.connectionIds || []
|
connections: rule?.connectionIds || []
|
||||||
@@ -443,8 +456,23 @@ export const RuleEditor: React.FC<RuleEditorProps> = ({ rule, onSave, onCancel }
|
|||||||
</Label>
|
</Label>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-xs text-muted-foreground">
|
<p className="text-xs text-muted-foreground">
|
||||||
When enabled, the system will automatically create separate groups for each distinct value
|
When enabled, the system will automatically create separate groups for each distinct attribute value
|
||||||
of the attribute variables used in the group name or OU
|
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>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -542,6 +570,12 @@ export const RuleEditor: React.FC<RuleEditorProps> = ({ rule, onSave, onCancel }
|
|||||||
{formData.createGroupForEachAttributeValue ? 'Yes' : 'No'}
|
{formData.createGroupForEachAttributeValue ? 'Yes' : 'No'}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</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">
|
<div className="flex justify-between">
|
||||||
<dt className="text-sm font-medium text-muted-foreground">Status:</dt>
|
<dt className="text-sm font-medium text-muted-foreground">Status:</dt>
|
||||||
<dd className="text-sm">
|
<dd className="text-sm">
|
||||||
|
|||||||
@@ -204,6 +204,7 @@ export const dynamicGroupRules = pgTable("dynamic_group_rules", {
|
|||||||
createGroupIfNotExists: boolean("create_group_if_not_exists").default(false),
|
createGroupIfNotExists: boolean("create_group_if_not_exists").default(false),
|
||||||
createOUIfNotExists: boolean("create_ou_if_not_exists").default(false),
|
createOUIfNotExists: boolean("create_ou_if_not_exists").default(false),
|
||||||
createGroupForEachAttributeValue: boolean("create_group_for_each_attribute_value").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)
|
// Rule conditions (filter logic)
|
||||||
|
|||||||
Reference in New Issue
Block a user