Skip to content
This repository was archived by the owner on Nov 4, 2020. It is now read-only.
Open
Changes from all 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
18 changes: 17 additions & 1 deletion gitlab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,21 @@ def editproject(self, project_id, **kwargs):
else:
return False

def shareproject(self, project_id, group_id, group_access):
"""Allow to share project with group.

:param project_id: The ID of a project
:param group_id: The ID of a group
:param group_access: Level of permissions for sharing
:return: True is success
"""
data = {"id": project_id, "group_id": group_id,
"group_access": group_access}

request = requests.post("{0}/{1}/share".format(self.projects_url, project_id),
headers=self.headers, data=data, verify=self.verify_ssl)
return request.status_code == 201


def deleteproject(self, project_id):
"""Delete a project
Expand Down Expand Up @@ -802,8 +817,9 @@ def createfork(self, project_id):
:return: True if succeed
"""

private_token = self.currentuser()['private_token']
request = requests.post("{0}/fork/{1}".format(self.projects_url, project_id),
timeout=self.timeout, verify=self.verify_ssl)
headers={"PRIVATE-TOKEN": private_token}, timeout=self.timeout, verify=self.verify_ssl)

if request.status_code == 200:
return True
Expand Down