Fix duplicate group names by removing default CN prefix

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/11b142bd-a00d-4c8a-b710-2021aa5fe994.jpg
This commit is contained in:
alphaeusmote
2025-04-10 18:17:40 +00:00
parent c5606639f5
commit 2af02d77d4
@@ -186,7 +186,13 @@ export const RuleEditor: React.FC<RuleEditorProps> = ({ rule, onSave, onCancel }
// Ensure targetOU has rootDSE
const fullOU = ensureRootDSE(formData.targetOU);
return `CN=${formData.targetGroupName},${fullOU}`;
// Check if the group name already has CN= prefix
const groupName = formData.targetGroupName.startsWith('CN=')
? formData.targetGroupName
: `CN=${formData.targetGroupName}`;
return `${groupName},${fullOU}`;
};
// Handle form submission
@@ -472,15 +478,14 @@ export const RuleEditor: React.FC<RuleEditorProps> = ({ rule, onSave, onCancel }
<div className="space-y-2">
<Label htmlFor="targetGroupName">Group Name <span className="text-destructive">*</span></Label>
<div className="flex gap-2">
<span className="py-2 px-3 bg-muted text-muted-foreground rounded-l-md border">CN=</span>
<div className="relative flex-1">
<Input
id="targetGroupName"
name="targetGroupName"
value={formData.targetGroupName}
onChange={handleInputChange}
className="rounded-l-none pr-24"
placeholder="GroupName"
className="pr-24"
placeholder="GroupName (CN= prefix will be added automatically)"
/>
<div className="absolute right-1 top-1">
<VariableSelector