Skip to content
This repository was archived by the owner on Nov 4, 2020. It is now read-only.

Commit 46d2c39

Browse files
Akos Henczlibtechadachi
Akos Hencz
authored andcommitted
Add support for project sharing
Gitlab EE feature: http://doc.gitlab.com/ee/api/projects.html#share-project-with-group
1 parent e436b38 commit 46d2c39

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

gitlab/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,21 @@ def editproject(self, project_id, **kwargs):
417417
else:
418418
return False
419419

420+
def shareproject(self, project_id, group_id, group_access):
421+
"""Allow to share project with group.
422+
423+
:param project_id: The ID of a project
424+
:param group_id: The ID of a group
425+
:param group_access: Level of permissions for sharing
426+
:return: True is success
427+
"""
428+
data = {"id": project_id, "group_id": group_id,
429+
"group_access": group_access}
430+
431+
request = requests.post("{0}/{1}/share".format(self.projects_url, project_id),
432+
headers=self.headers, data=data, verify=self.verify_ssl)
433+
return request.status_code == 201
434+
420435

421436
def deleteproject(self, project_id):
422437
"""Delete a project

0 commit comments

Comments
 (0)