mirror of
https://github.com/freedbygrace/ActiveDirectoryManager.git
synced 2026-08-21 07:37:32 +00:00
Add option to automatically include rootDSE in OU paths
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/5ed4a3a4-e383-48c9-beb9-321c509bc354.jpg
This commit is contained in:
@@ -82,6 +82,7 @@ export const RuleEditor: React.FC<RuleEditorProps> = ({ rule, onSave, onCancel }
|
|||||||
createOUIfNotExists: boolean;
|
createOUIfNotExists: boolean;
|
||||||
createGroupForEachAttributeValue: boolean;
|
createGroupForEachAttributeValue: boolean;
|
||||||
createOUForEachAttributeValue: boolean;
|
createOUForEachAttributeValue: boolean;
|
||||||
|
autoAddRootDSE: boolean;
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
variablePattern: string;
|
variablePattern: string;
|
||||||
connections: number[];
|
connections: number[];
|
||||||
@@ -94,6 +95,7 @@ export const RuleEditor: React.FC<RuleEditorProps> = ({ rule, onSave, onCancel }
|
|||||||
createOUIfNotExists: rule?.createOUIfNotExists || false,
|
createOUIfNotExists: rule?.createOUIfNotExists || false,
|
||||||
createGroupForEachAttributeValue: rule?.createGroupForEachAttributeValue || false,
|
createGroupForEachAttributeValue: rule?.createGroupForEachAttributeValue || false,
|
||||||
createOUForEachAttributeValue: rule?.createOUForEachAttributeValue || false,
|
createOUForEachAttributeValue: rule?.createOUForEachAttributeValue || false,
|
||||||
|
autoAddRootDSE: true, // Default to true for better user experience
|
||||||
enabled: rule?.enabled ?? true,
|
enabled: rule?.enabled ?? true,
|
||||||
variablePattern: rule?.variablePattern || '',
|
variablePattern: rule?.variablePattern || '',
|
||||||
connections: rule?.connectionIds || []
|
connections: rule?.connectionIds || []
|
||||||
@@ -167,10 +169,15 @@ export const RuleEditor: React.FC<RuleEditorProps> = ({ rule, onSave, onCancel }
|
|||||||
return domainParts.map(part => `DC=${part}`).join(',');
|
return domainParts.map(part => `DC=${part}`).join(',');
|
||||||
};
|
};
|
||||||
|
|
||||||
// Ensure OU path has rootDSE appended
|
// Ensure OU path has rootDSE appended if autoAddRootDSE is enabled
|
||||||
const ensureRootDSE = (ouPath: string) => {
|
const ensureRootDSE = (ouPath: string) => {
|
||||||
if (!ouPath) return '';
|
if (!ouPath) return '';
|
||||||
|
|
||||||
|
// If autoAddRootDSE is disabled, return the path as is
|
||||||
|
if (!formData.autoAddRootDSE) {
|
||||||
|
return ouPath;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the path already contains DC=
|
// Check if the path already contains DC=
|
||||||
if (ouPath.includes('DC=')) {
|
if (ouPath.includes('DC=')) {
|
||||||
return ouPath;
|
return ouPath;
|
||||||
@@ -475,6 +482,15 @@ export const RuleEditor: React.FC<RuleEditorProps> = ({ rule, onSave, onCancel }
|
|||||||
<Label htmlFor="createOUIfNotExists">Create OU if it doesn't exist</Label>
|
<Label htmlFor="createOUIfNotExists">Create OU if it doesn't exist</Label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center space-x-2">
|
||||||
|
<Switch
|
||||||
|
id="autoAddRootDSE"
|
||||||
|
checked={formData.autoAddRootDSE}
|
||||||
|
onCheckedChange={(checked) => handleToggleChange('autoAddRootDSE', checked)}
|
||||||
|
/>
|
||||||
|
<Label htmlFor="autoAddRootDSE">Automatically add root DSE to OU path</Label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor="targetGroupName">Group Name <span className="text-destructive">*</span></Label>
|
<Label htmlFor="targetGroupName">Group Name <span className="text-destructive">*</span></Label>
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
@@ -636,6 +652,12 @@ export const RuleEditor: React.FC<RuleEditorProps> = ({ rule, onSave, onCancel }
|
|||||||
{formData.createOUIfNotExists ? 'Yes' : 'No'}
|
{formData.createOUIfNotExists ? 'Yes' : 'No'}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<dt className="text-sm font-medium text-muted-foreground">Auto-add root DSE:</dt>
|
||||||
|
<dd className="text-sm">
|
||||||
|
{formData.autoAddRootDSE ? 'Yes' : 'No'}
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<dt className="text-sm font-medium text-muted-foreground">Create groups per attribute value:</dt>
|
<dt className="text-sm font-medium text-muted-foreground">Create groups per attribute value:</dt>
|
||||||
<dd className="text-sm">
|
<dd className="text-sm">
|
||||||
|
|||||||
Reference in New Issue
Block a user