Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[feature] Add support for members all() method#642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
max-wittig merged 1 commit intomasterfromfeature/589/member_all
Nov 28, 2018
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletionsdocs/gl_objects/groups.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -164,6 +164,11 @@ List group members::

members = group.members.list()

List the group members recursively (including inherited members through
ancestor groups)::

members = group.members.all(all=True)

Get a group member::

members = group.members.get(member_id)
Expand Down
5 changes: 5 additions & 0 deletionsdocs/gl_objects/projects.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -478,6 +478,11 @@ List the project members::

members = project.members.list()

List the project members recursively (including inherited members through
ancestor groups)::

members = project.members.all(all=True)

Search project members matching a query string::

members = project.members.list(query='bar')
Expand Down
48 changes: 48 additions & 0 deletionsgitlab/v4/objects.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand DownExpand Up@@ -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
Expand Down
1 change: 1 addition & 0 deletionstools/python_test_v4.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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()
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp