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

Commit59e3e45

Browse files
authored
Merge pull request#656 from esabouraud/feature-protectedbranchesoptions
Issue 653 Add access control options to protected branch creation
2 parents728f2dd +cebbbf6 commit59e3e45

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

‎docs/gl_objects/protected_branches.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ Create a protected branch::
3535
'push_access_level': gitlab.MAINTAINER_ACCESS
3636
})
3737

38+
Create a protected branch with more granular access control::
39+
40+
p_branch = project.protectedbranches.create({
41+
'name': '*-stable',
42+
'allowed_to_push': [{"user_id": 99}, {"user_id": 98}],
43+
'allowed_to_merge': [{"group_id": 653}],
44+
'allowed_to_unprotect': [{"access_level": gitlab.MAINTAINER_ACCESS}]
45+
})
46+
3847
Delete a protected branch::
3948

4049
project.protectedbranches.delete('*-stable')

‎gitlab/v4/objects.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3117,7 +3117,10 @@ class ProjectProtectedBranchManager(NoUpdateMixin, RESTManager):
31173117
_path='/projects/%(project_id)s/protected_branches'
31183118
_obj_cls=ProjectProtectedBranch
31193119
_from_parent_attrs= {'project_id':'id'}
3120-
_create_attrs= (('name', ), ('push_access_level','merge_access_level'))
3120+
_create_attrs= (('name', ),
3121+
('push_access_level','merge_access_level',
3122+
'unprotect_access_level','allowed_to_push',
3123+
'allowed_to_merge','allowed_to_unprotect'))
31213124

31223125

31233126
classProjectRunner(ObjectDeleteMixin,RESTObject):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp