Repository: python-gitlab/python-gitlab

Issue:
/groups/:id/members/all not yet supported?
## Description of the problem, including code/CLI snippet

I want to use the api endpoint ```GET /groups/:id/members/all```, but that does not seem supported. ```GET /groups/:id/members/``` is (difference: /all includes all inheritance)

## Expected Behavior

Being able to use it, eg ```gitlab group-member-all list --group_id $id```

## Actual Behavior

not supported

## Specifications

  - python-gitlab version: 1.6.0
  - API version you are using (v3/v4): v4
  - Gitlab server version (or gitlab.com): gitlab.com

see also: https://docs.gitlab.com/ee/api/members.html#list-all-members-of-a-group-or-project-including-inherited-members


Discussion:
Hi @hans-d 

You are right, this is not yet supported. Thanks for reporting the issue!

Resolving patch:
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py
--- a/gitlab/v4/objects.py
+++ b/gitlab/v4/objects.py
@@ -705,6 +705,30 @@ class GroupMemberManager(CRUDMixin, RESTManager):
     _create_attrs = (('access_level', 'user_id'), ('expires_at', ))
     _update_attrs = (('access_level', ), ('expires_at', ))
 
+    @cli.register_custom_action('GroupMemberManager')
+    @exc.on_http_error(exc.GitlabListError)
+    def all(self, **kwargs):
+        """List all the members, included inherited ones.
+
+        Args:
+            all (bool): If True, return all the items, without pagination
+            per_page (int): Number of items to retrieve per request
+            page (int): ID of the page to return (starts with page 1)
+            as_list (bool): If set to False and no pagination option is
+                defined, return a generator instead of a list
+            **kwargs: Extra options to send to the server (e.g. sudo)
+
+        Raises:
+            GitlabAuthenticationError: If authentication is not correct
+            GitlabListError: If the list could not be retrieved
+
+        Returns:
+            RESTObjectList: The list of members
+        """
+
+        path = '%s/all' % self.path
+        return self.gitlab.http_list(path, **kwargs)
+
 
 class GroupMergeRequest(RESTObject):
     pass
@@ -1884,6 +1908,30 @@ class ProjectMemberManager(CRUDMixin, RESTManager):
     _create_attrs = (('access_level', 'user_id'), ('expires_at', ))
     _update_attrs = (('access_level', ), ('expires_at', ))
 
+    @cli.register_custom_action('ProjectMemberManager')
+    @exc.on_http_error(exc.GitlabListError)
+    def all(self, **kwargs):
+        """List all the members, included inherited ones.
+
+        Args:
+            all (bool): If True, return all the items, without pagination
+            per_page (int): Number of items to retrieve per request
+            page (int): ID of the page to return (starts with page 1)
+            as_list (bool): If set to False and no pagination option is
+                defined, return a generator instead of a list
+            **kwargs: Extra options to send to the server (e.g. sudo)
+
+        Raises:
+            GitlabAuthenticationError: If authentication is not correct
+            GitlabListError: If the list could not be retrieved
+
+        Returns:
+            RESTObjectList: The list of members
+        """
+
+        path = '%s/all' % self.path
+        return self.gitlab.http_list(path, **kwargs)
+
 
 class ProjectNote(RESTObject):
     pass


Test patch:
diff --git a/tools/python_test_v4.py b/tools/python_test_v4.py
--- a/tools/python_test_v4.py
+++ b/tools/python_test_v4.py
@@ -244,6 +244,7 @@
 
 group1.members.delete(user1.id)
 assert(len(group1.members.list()) == 2)
+assert(len(group1.members.all()))
 member = group1.members.get(user2.id)
 member.access_level = gitlab.const.OWNER_ACCESS
 member.save()