mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-25 08:21:05 -06:00
Do a better query so we can optimize seeing if a cospriority is unique
This commit is contained in:
parent
04cb57eeb6
commit
9922f47ecb
@ -140,13 +140,17 @@ def unique_priority(ldap, priority):
|
|||||||
This isn't done as a validation on the attribute since we want it done
|
This isn't done as a validation on the attribute since we want it done
|
||||||
only on the server side.
|
only on the server side.
|
||||||
"""
|
"""
|
||||||
(entries, truncated) = find_group_policy(ldap)
|
attrs = ('cospriority',)
|
||||||
for e in entries:
|
|
||||||
groupdn = find_group_dn(e[1]['cn'][0])
|
attr_filter = ldap.make_filter({'objectclass':'krbcontainer', 'cospriority':
|
||||||
cos_dn = 'cn="%s", cn=cosTemplates, cn=accounts, %s' % (groupdn, api.env.basedn)
|
|
||||||
(dn, cos_attrs) = ldap.get_entry(cos_dn, normalize=False)
|
try:
|
||||||
if priority == int(cos_attrs['cospriority'][0]):
|
(entries, truncated) = ldap.find_entries(
|
||||||
return False
|
attr_filter, attrs, 'cn=cosTemplates,%s' % (api.env.container_accoun
|
||||||
|
)
|
||||||
|
return False
|
||||||
|
except errors.NotFound:
|
||||||
|
return True
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user