From 235c4ce3d7d5459974fa1995f6d58f4268ebfc7e Mon Sep 17 00:00:00 2001 From: Derek Yarnell Date: Mon, 16 Apr 2012 15:23:12 -0400 Subject: Implementation of tenant,user,role list functions for ldap Bug 983304 Defines functions for the retrival and return of the tenant, user and role objects in ldap. They will return in whatever order LDAP provides them. Additional fix for pep8 whitespace violation. Additional change to add some minimal unit tests for the new functions Tests have successfully run against a live LDAP server Change-Id: I368ae4097bb9bcdaab7bca0ccc2f9204d58f69d8 --- keystone/identity/backends/ldap/core.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'keystone') diff --git a/keystone/identity/backends/ldap/core.py b/keystone/identity/backends/ldap/core.py index c3dd52cb..5b32a679 100644 --- a/keystone/identity/backends/ldap/core.py +++ b/keystone/identity/backends/ldap/core.py @@ -116,6 +116,9 @@ class Identity(identity.Driver): except exception.NotFound: raise exception.TenantNotFound(tenant_id=tenant_id) + def get_tenants(self): + return self.tenant.get_all() + def get_tenant_by_name(self, tenant_name): try: return self.tenant.get_by_name(tenant_name) @@ -131,6 +134,9 @@ class Identity(identity.Driver): def get_user(self, user_id): return _filter_user(self._get_user(user_id)) + def list_users(self): + return self.user.get_all() + def get_user_by_name(self, user_name): try: return _filter_user(self.user.get_by_name(user_name)) @@ -152,6 +158,9 @@ class Identity(identity.Driver): except exception.NotFound: raise exception.RoleNotFound(role_id=role_id) + def list_roles(self): + return self.role.get_all() + # These should probably be part of the high-level API # When this happens, then change TenantAPI.add_user to not ignore # ldap.TYPE_OR_VALUE_EXISTS -- cgit