diff --git a/api/auth/groupauth.py b/api/auth/groupauth.py index 1ef86146c7844e5f9bc664754fc1795ba0a542c4..fd98052d5775e959557cbdc98a971447d1c1e2a6 100644 --- a/api/auth/groupauth.py +++ b/api/auth/groupauth.py @@ -36,13 +36,10 @@ def list_permission_checker(handler, uid=None): projection = projection or {} projection['permissions.$'] = 1 else: - if not handler.superuser_request and not handler.user_is_admin: + if not handler.superuser_request: query = query or {} projection = projection or {} - if handler.is_true('admin'): - query['permissions'] = {'$elemMatch': {'_id': handler.uid, 'access': 'admin'}} - else: - query['permissions._id'] = handler.uid + query['permissions._id'] = handler.uid return exec_op(method, query=query, projection=projection) return f diff --git a/tests/integration_tests/python/test_groups.py b/tests/integration_tests/python/test_groups.py index 9d61487d745bef9420cd64ada8262aa517691683..9ebcddf1fb0f2f07f49a94e92e5fba786fd8d8f8 100644 --- a/tests/integration_tests/python/test_groups.py +++ b/tests/integration_tests/python/test_groups.py @@ -128,4 +128,4 @@ def test_groups(as_user, as_admin, data_builder): project = data_builder.create_project() r = as_admin.get('/groups', params={'join': 'projects'}) assert r.ok - assert r.json()[1].get('projects')[0].get('_id') == project + assert r.json()[0].get('projects')[0].get('_id') == project