Skip to content

Commit 71c8750

Browse files
author
Gauvain Pocentek
committed
Add support for Gitlab 6.1 group members
1 parent 09ef68f commit 71c8750

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Version 0.4
44
* Allow to get a project commit (GitLab 6.1)
55
* ProjectMergeRequest: fix Note() method
66
* Gitlab 6.1 methods: diff, blob (commit), tree, blob (project)
7+
* Add support for Gitlab 6.1 group members
78

89
Version 0.3
910

gitlab.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def list(self, obj_class, **kwargs):
187187
cls = obj_class
188188
if obj_class._returnClass:
189189
cls = obj_class._returnClass
190-
l = [cls(self, item) for item in r.json()]
190+
l = [cls(self, item) for item in r.json() if item is not None]
191191
if kwargs:
192192
for k, v in kwargs.items():
193193
if k in ('page', 'per_page'):
@@ -571,12 +571,26 @@ def Key(self, id=None, **kwargs):
571571
return CurrentUserKey(self.gitlab, id)
572572

573573

574+
class GroupMember(GitlabObject):
575+
_url = '/groups/%(group_id)s/members'
576+
canGet = False
577+
canUpdate = False
578+
requiredCreateAttrs = ['group_id', 'user_id', 'access_level']
579+
requiredDeleteAttrs = ['group_id', 'user_id']
580+
shortPrintAttr = 'username'
581+
582+
574583
class Group(GitlabObject):
575584
_url = '/groups'
576585
_constructorTypes = {'projects': 'Project'}
577586
requiredCreateAttrs = ['name', 'path']
578587
shortPrintAttr = 'name'
579588

589+
def Member(self, id=None, **kwargs):
590+
return self._getListOrObject(GroupMember, id,
591+
group_id=self.id,
592+
**kwargs)
593+
580594
def transfer_project(self, id):
581595
url = '/groups/%d/projects/%d' % (self.id, id)
582596
r = self.gitlab.rawPost(url, None)

0 commit comments

Comments
 (0)