diff options
| author | termie <github@anarkystic.com> | 2012-01-04 17:13:23 -0800 |
|---|---|---|
| committer | termie <github@anarkystic.com> | 2012-01-04 17:13:23 -0800 |
| commit | 5c89972ffeb2256c362773cc367440edbe16f623 (patch) | |
| tree | 2d06f6e2637722d25fb908a3ff9c6c116d6ef260 | |
| parent | 46943c5f4110042756f0919a45cff11544548c7b (diff) | |
add list users
| -rw-r--r-- | keystonelight/backends/kvs.py | 9 | ||||
| -rw-r--r-- | keystonelight/identity.py | 5 | ||||
| -rw-r--r-- | keystonelight/keystone_compat.py | 8 |
3 files changed, 21 insertions, 1 deletions
diff --git a/keystonelight/backends/kvs.py b/keystonelight/backends/kvs.py index 439c4dee..9b989086 100644 --- a/keystonelight/backends/kvs.py +++ b/keystonelight/backends/kvs.py @@ -63,6 +63,9 @@ class KvsIdentity(object): role_ref = self.db.get('role-%s' % role_id) return role_ref + def list_users(self): + return self.db.get('user_list', []) + # These should probably be part of the high-level API def add_user_to_tenant(self, tenant_id, user_id): user_ref = self.get_user(user_id) @@ -112,6 +115,9 @@ class KvsIdentity(object): def create_user(self, id, user): self.db.set('user-%s' % id, user) self.db.set('user_name-%s' % user['name'], user) + user_list = set(self.db.get('user_list', [])) + user_list.add(id) + self.db.set('user_list', list(user_list)) return user def update_user(self, id, user): @@ -126,6 +132,9 @@ class KvsIdentity(object): old_user = self.db.get('user-%s' % id) self.db.delete('user_name-%s' % old_user['name']) self.db.delete('user-%s' % id) + user_list = set(self.db.get('user_list', [])) + user_list.remove(id) + self.db.set('user_list', list(user_list)) return None def create_tenant(self, id, tenant): diff --git a/keystonelight/identity.py b/keystonelight/identity.py index dc761494..8e69a97b 100644 --- a/keystonelight/identity.py +++ b/keystonelight/identity.py @@ -37,6 +37,11 @@ class Manager(object): def get_role(self, context, role_id): return self.driver.get_role(role_id) + # NOTE(termie): i think it will probably be a bad move in the end to try to + # list all users + def list_users(self, context): + return self.driver.list_users() + # These should probably be the high-level API calls def add_user_to_tenant(self, context, user_id, tenant_id): self.driver.add_user_to_tenant(user_id, tenant_id) diff --git a/keystonelight/keystone_compat.py b/keystonelight/keystone_compat.py index de2e3082..1398af71 100644 --- a/keystonelight/keystone_compat.py +++ b/keystonelight/keystone_compat.py @@ -587,6 +587,13 @@ class KeystoneUserController(service.BaseApplication): raise exc.HTTPNotFound() return {'user': user_ref} + def get_users(self, context): + # NOTE(termie): i can't imagine that this really wants all the data + # about every single user in the system... + self.assert_admin(context) + user_list = self.identity_api.list_users(context) + return {'users': [{'id': x} for x in user_list]} + # CRUD extension def create_user(self, context, user): self.assert_admin(context) @@ -630,7 +637,6 @@ class KeystoneUserController(service.BaseApplication): return self.update_user(context, user_id, user) - class KeystoneRoleController(service.BaseApplication): def __init__(self, options): self.options = options |
