From 84ad1225dc21d3e93d686863af86438b6145134f Mon Sep 17 00:00:00 2001 From: Harsha Kethineni <harshakethineni@flywheel.io> Date: Mon, 9 Oct 2017 15:00:34 -0500 Subject: [PATCH] /users/uid/groups returns permission for uid --- api/handlers/grouphandler.py | 2 +- test/integration_tests/python/test_groups.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/api/handlers/grouphandler.py b/api/handlers/grouphandler.py index 2b55f9fd..a006b120 100644 --- a/api/handlers/grouphandler.py +++ b/api/handlers/grouphandler.py @@ -48,7 +48,7 @@ class GroupHandler(base.RequestHandler): projection = {'label': 1, 'created': 1, 'modified': 1, 'permissions': 1, 'tags': 1} permchecker = groupauth.list_permission_checker(self, uid) results = permchecker(self.storage.exec_op)('GET', projection=projection) - if not self.superuser_request and not self.is_true('join_avatars'): + if not self.superuser_request and not self.is_true('join_avatars') and not self.user_is_admin: self._filter_permissions(results, self.uid) if self.is_true('join_avatars'): results = ContainerHandler.join_user_info(results) diff --git a/test/integration_tests/python/test_groups.py b/test/integration_tests/python/test_groups.py index 42c457fb..9d61487d 100644 --- a/test/integration_tests/python/test_groups.py +++ b/test/integration_tests/python/test_groups.py @@ -82,6 +82,11 @@ def test_groups(as_user, as_admin, data_builder): r = as_admin.put('/groups/' + group + '/permissions/' + user['_id'], json=user) assert r.ok + # Get all permissions for each group + r = as_admin.get('/users/admin@user.com/groups') + assert r.ok + assert r.json()[0].get("permissions")[0].get("_id") == "admin@user.com" + # Get the group again to compare timestamps for the Edit permission test groups r = as_admin.get('/groups/' + group) assert r.ok -- GitLab