Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
729d9ea6
Commit
729d9ea6
authored
Nov 29, 2019
by
Greg Messner
Browse files
Fixed userId based protectBranch() method (#479).
parent
22ede8a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/ProtectedBranchesApi.java
View file @
729d9ea6
...
...
@@ -176,22 +176,22 @@ public class ProtectedBranchesApi extends AbstractApi {
*
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param branchName the name of the branch to protect, can be a wildcard
* @param allowedToPush user ID allowed to push, can be null
* @param allowedToMerge user ID allowed to merge, can be null
* @param allowedToUnprotect user ID allowed to unprotect, can be null
* @param allowedToPush
UserId
user ID allowed to push, can be null
* @param allowedToMerge
UserId
user ID allowed to merge, can be null
* @param allowedToUnprotect
UserId
user ID allowed to unprotect, can be null
* @param codeOwnerApprovalRequired prevent pushes to this branch if it matches an item in the CODEOWNERS file. (defaults: false)
* @return the branch info for the protected branch
* @throws GitLabApiException if any exception occurs
*/
public
ProtectedBranch
protectBranch
(
Object
projectIdOrPath
,
String
branchName
,
Integer
allowedToPush
,
Integer
allowedToMerge
,
Integer
allowedToUnprotect
,
Integer
allowedToPush
UserId
,
Integer
allowedToMerge
UserId
,
Integer
allowedToUnprotect
UserId
,
Boolean
codeOwnerApprovalRequired
)
throws
GitLabApiException
{
Form
formData
=
new
GitLabApiForm
()
.
withParam
(
"name"
,
branchName
,
true
)
.
withParam
(
"allowed_to_push[][user_id]"
,
allowedToPush
)
.
withParam
(
"allowed_to_merge[][user_id]"
,
allowedToMerge
)
.
withParam
(
"allowed_to_
merge
[][user_id]"
,
allowedToUnprotect
)
.
withParam
(
"allowed_to_push[][user_id]"
,
allowedToPush
UserId
)
.
withParam
(
"allowed_to_merge[][user_id]"
,
allowedToMerge
UserId
)
.
withParam
(
"allowed_to_
unprotect
[][user_id]"
,
allowedToUnprotect
UserId
)
.
withParam
(
"code_owner_approval_required"
,
codeOwnerApprovalRequired
);
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
.
asMap
(),
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"protected_branches"
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment