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

Commite7c4125

Browse files
author
Gauvain Pocentek
committed
Implement sharing project with a group
1 parentdcf31a4 commite7c4125

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

‎docs/gl_objects/projects.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,7 @@
105105
# or
106106
member.delete()
107107
# end members delete
108+
109+
# share
110+
project.share(group.id,group.DEVELOPER_ACCESS)
111+
# end share

‎docs/gl_objects/projects.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,9 @@ Remove a member from the project team:
137137
..literalinclude::projects.py
138138
:start-after: # members delete
139139
:end-before: # end members delete
140+
141+
Share the project with a group:
142+
143+
..literalinclude::projects.py
144+
:start-after: # share
145+
:end-before: # end share

‎gitlab/objects.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,6 +1948,22 @@ def unarchive_(self, **kwargs):
19481948
raise_error_from_response(r,GitlabCreateError,201)
19491949
returnProject(self.gitlab,r.json())ifr.status_code==201elseself
19501950

1951+
defshare(self,group_id,group_access,**kwargs):
1952+
"""Share the project with a group.
1953+
1954+
Args:
1955+
group_id (int): ID of the group.
1956+
group_access (int): Access level for the group.
1957+
1958+
Raises:
1959+
GitlabConnectionError: If the server cannot be reached.
1960+
GitlabCreateError: If the server fails to perform the request.
1961+
"""
1962+
url="/projects/%s/share"%self.id
1963+
data= {'group_id':group_id,'group_access':group_access}
1964+
r=self.gitlab._raw_post(url,data=data,**kwargs)
1965+
raise_error_from_response(r,GitlabCreateError,201)
1966+
19511967

19521968
classTeamMember(GitlabObject):
19531969
_url='/user_teams/%(team_id)s/members'

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp