Skip to content

Commit 47f0420

Browse files
committed
Add support for group membership API calls added in GitLab 6.1
<group>.members(), <group>.add_member(), <group>.delete_member()
1 parent 50921b3 commit 47f0420

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

gitlab3/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
ACCESS_LEVEL_REPORTER = 20
2626
ACCESS_LEVEL_DEVELOPER = 30
2727
ACCESS_LEVEL_MASTER = 40
28+
ACCESS_LEVEL_OWNER = 50
2829

2930
# Maximum 'per_page' value allowed by GitLab when listing
3031
_MAX_PER_PAGE = 100

gitlab3/_api_definition.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ class SSHKey(APIDefinition):
6767
]
6868

6969

70+
class Member(APIDefinition):
71+
url = '/members/:user_id'
72+
actions = [ _LIST, _GET, _ADD, _EDIT, _DELETE ]
73+
required_params = [
74+
'user_id',
75+
'access_level',
76+
]
77+
78+
7079
class CurrentUser(APIDefinition):
7180
url = '/user'
7281
actions = [ _GET ]
@@ -81,6 +90,8 @@ class Group(APIDefinition):
8190
'path',
8291
]
8392

93+
####
94+
# Extra Actions
8495
class TransferProjectAction(ExtraActionDefinition):
8596
"""gl.Group.transfer_project(project_id)"""
8697
url = '/projects/:project_id'
@@ -90,6 +101,12 @@ class TransferProjectAction(ExtraActionDefinition):
90101
]
91102
extra_actions = [ TransferProjectAction ]
92103

104+
###
105+
# Sub APIs
106+
class Member(Member): # Group API has limited Member actions...
107+
actions = [ _LIST, _ADD, _DELETE ]
108+
sub_apis = [ Member ]
109+
93110

94111
class SystemHook(APIDefinition):
95112
url = '/hooks/:id'
@@ -109,15 +126,6 @@ class Issue(APIDefinition):
109126
actions = [ _LIST ]
110127

111128

112-
class Member(APIDefinition):
113-
url = '/members/:user_id'
114-
actions = [ _LIST, _GET, _ADD, _EDIT, _DELETE ]
115-
required_params = [
116-
'user_id',
117-
'access_level',
118-
]
119-
120-
121129
class Note(APIDefinition):
122130
url = '/notes/:note_id'
123131
actions = [ _LIST, _GET, _ADD ]

0 commit comments

Comments
 (0)