"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "keystone/identity/backends/ldap/common.py" between
keystone-16.0.0.tar.gz and keystone-16.0.1.tar.gz

About: OpenStack Keystone (Core Service: Identity) provides an authentication and authorization service for other OpenStack services. Provides a catalog of endpoints for all OpenStack services.
The "Train" series (latest release).

common.py  (keystone-16.0.0):common.py  (keystone-16.0.1)
skipping to change at line 1791 skipping to change at line 1791
self.enabled_emulation_dn = '%s=%s,%s' % sub_vals self.enabled_emulation_dn = '%s=%s,%s' % sub_vals
naming_attr = (naming_attr_name, [naming_attr_value]) naming_attr = (naming_attr_name, [naming_attr_value])
else: else:
# Extract the attribute name and value from the configured DN. # Extract the attribute name and value from the configured DN.
naming_dn = ldap.dn.str2dn(self.enabled_emulation_dn) naming_dn = ldap.dn.str2dn(self.enabled_emulation_dn)
naming_rdn = naming_dn[0][0] naming_rdn = naming_dn[0][0]
naming_attr = (naming_rdn[0], naming_attr = (naming_rdn[0],
naming_rdn[1]) naming_rdn[1])
self.enabled_emulation_naming_attr = naming_attr self.enabled_emulation_naming_attr = naming_attr
# TODO(yoctozepto): methods below use _id_to_dn which requests another LDAP # TODO(yoctozepto): methods below use _id_to_dn which requests another
connection - optimize it # LDAP connection - optimize it
def _get_enabled(self, object_id, conn): def _get_enabled(self, object_id, conn):
if self.group_members_are_ids: if self.group_members_are_ids:
dn = object_id dn = object_id
else: else:
dn = self._id_to_dn(object_id) dn = self._id_to_dn(object_id)
query = '(%s=%s)' % (self.member_attribute, query = '(%s=%s)' % (self.member_attribute,
ldap.filter.escape_filter_chars(dn)) ldap.filter.escape_filter_chars(dn))
try: try:
enabled_value = conn.search_s(self.enabled_emulation_dn, enabled_value = conn.search_s(self.enabled_emulation_dn,
skipping to change at line 1815 skipping to change at line 1816
return False return False
else: else:
return bool(enabled_value) return bool(enabled_value)
def _add_enabled(self, object_id): def _add_enabled(self, object_id):
if self.group_members_are_ids: if self.group_members_are_ids:
dn = object_id dn = object_id
else: else:
dn = self._id_to_dn(object_id) dn = self._id_to_dn(object_id)
with self.get_connection() as conn: with self.get_connection() as conn:
# TODO(yoctozepto): _get_enabled potentially calls _id_to_dn 2nd tim # TODO(yoctozepto): _get_enabled potentially calls
e - optimize it # _id_to_dn 2nd time - optimize it
if not self._get_enabled(object_id, conn): if not self._get_enabled(object_id, conn):
modlist = [(ldap.MOD_ADD, modlist = [(ldap.MOD_ADD,
self.member_attribute, self.member_attribute,
[dn])] [dn])]
try: try:
conn.modify_s(self.enabled_emulation_dn, modlist) conn.modify_s(self.enabled_emulation_dn, modlist)
except ldap.NO_SUCH_OBJECT: except ldap.NO_SUCH_OBJECT:
attr_list = [('objectClass', [self.group_objectclass]), attr_list = [('objectClass', [self.group_objectclass]),
(self.member_attribute, (self.member_attribute,
[dn]), [dn]),
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)