Require uniqueness in the name/comment field of delegations

Fix error reporting in the UI to include the detailed message
Sort delegations by name when displaying them
Update the name field from "Name" to "Delegation Name"
This commit is contained in:
Rob Crittenden
2007-11-09 13:58:36 -05:00
parent 6f03dde1ab
commit 705d68ddcb
5 changed files with 63 additions and 7 deletions

View File

@@ -90,6 +90,25 @@ def main():
new_aci.dest_group = target_grp[1].dn
new_aci.attrs = attr_list
aci_entry = client.get_aci_entry(['*', 'aci'])
# Look for an existing ACI of the same name
aci_str_list = aci_entry.getValues('aci')
if aci_str_list is None:
aci_str_list = []
if not(isinstance(aci_str_list,list) or isinstance(aci_str_list,tuple)):
aci_str_list = [aci_str_list]
for aci_str in aci_str_list:
try:
old_aci = ipa.aci.ACI(aci_str)
if old_aci.name == new_aci.name:
print "A delegation of that name already exists"
return 2
except SyntaxError:
# ignore aci_str's that ACI can't parse
pass
aci_entry = client.get_aci_entry(['dn'])
aci_entry.setValue('aci', new_aci.export_to_string())