mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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:
@@ -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())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user