Commit b87da212 authored by Greg Messner's avatar Greg Messner
Browse files

Deprecated MASTER and added MAINTAINER access level (#198).

parent 3b857649
...@@ -53,7 +53,7 @@ public class ProtectedBranchesApi extends AbstractApi { ...@@ -53,7 +53,7 @@ public class ProtectedBranchesApi extends AbstractApi {
* @throws GitLabApiException if any exception occurs * @throws GitLabApiException if any exception occurs
*/ */
public ProtectedBranch protectBranch(Integer projectId, String branchName) throws GitLabApiException { public ProtectedBranch protectBranch(Integer projectId, String branchName) throws GitLabApiException {
return protectBranch(projectId, branchName, AccessLevel.MASTER, AccessLevel.MASTER); return protectBranch(projectId, branchName, AccessLevel.MAINTAINER, AccessLevel.MAINTAINER);
} }
/** /**
...@@ -63,8 +63,8 @@ public class ProtectedBranchesApi extends AbstractApi { ...@@ -63,8 +63,8 @@ public class ProtectedBranchesApi extends AbstractApi {
* *
* @param projectId the ID of the project to protect * @param projectId the ID of the project to protect
* @param branchName the name of the branch to protect * @param branchName the name of the branch to protect
* @param pushAccessLevel Access levels allowed to push (defaults: 40, master access level) * @param pushAccessLevel Access levels allowed to push (defaults: 40, maintainer access level)
* @param mergeAccessLevel Access levels allowed to merge (defaults: 40, master access level) * @param mergeAccessLevel Access levels allowed to merge (defaults: 40, maintainer access level)
* @return the branch info for the protected branch * @return the branch info for the protected branch
* @throws GitLabApiException if any exception occurs * @throws GitLabApiException if any exception occurs
*/ */
......
...@@ -10,7 +10,7 @@ import com.fasterxml.jackson.annotation.JsonValue; ...@@ -10,7 +10,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
public enum AccessLevel { public enum AccessLevel {
INVALID(-1), NONE(0), GUEST(10), REPORTER(20), DEVELOPER(30), MASTER(40), OWNER(50); INVALID(-1), NONE(0), GUEST(10), REPORTER(20), DEVELOPER(30), @Deprecated MASTER(40), MAINTAINER(40), OWNER(50), ADMIN(60);
public final Integer value; public final Integer value;
...@@ -18,10 +18,13 @@ public enum AccessLevel { ...@@ -18,10 +18,13 @@ public enum AccessLevel {
this.value = value; this.value = value;
} }
private static Map<Integer, AccessLevel> valuesMap = new HashMap<Integer, AccessLevel>(6); private static Map<Integer, AccessLevel> valuesMap = new HashMap<Integer, AccessLevel>(9);
static { static {
for (AccessLevel accessLevel : AccessLevel.values()) for (AccessLevel accessLevel : AccessLevel.values())
valuesMap.put(accessLevel.value, accessLevel); valuesMap.put(accessLevel.value, accessLevel);
// Make sure MAINTAINER is mapped to 40 and not MASTER (MASTER is deprecated)
valuesMap.put(MAINTAINER.value, MAINTAINER);
} }
@JsonCreator @JsonCreator
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment