Skip to content

Commit b1bb369

Browse files
committed
Merge remote-tracking branch 'origin/main' into 6.x
2 parents aac8235 + a7fe866 commit b1bb369

File tree

3 files changed

+51
-4
lines changed

3 files changed

+51
-4
lines changed

src/main/java/org/gitlab4j/api/GroupApi.java

+39-3
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,26 @@ public void addSamlGroupLink(Object groupIdOrPath, String samlGroupName, AccessL
13131313
addSamlGroupLink(groupIdOrPath, samlGroupName, groupAccess.toValue());
13141314
}
13151315

1316+
/**
1317+
* Adds an SAML group link.
1318+
*
1319+
* <pre><code>GitLab Endpoint: POST /groups/:id/saml_group_links</code></pre>
1320+
*
1321+
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
1322+
* @param samlGroupName the name of the SAML group
1323+
* @param groupAccess the minimum access level for members of the SAML group
1324+
* @param memberRoleId the id of the custom member role to assign
1325+
* @throws GitLabApiException if any exception occurs
1326+
*/
1327+
public void addSamlGroupLink(Object groupIdOrPath, String samlGroupName, AccessLevel groupAccess, int memberRoleId) throws GitLabApiException {
1328+
1329+
if (groupAccess == null) {
1330+
throw new RuntimeException("groupAccess cannot be null or empty");
1331+
}
1332+
1333+
addSamlGroupLink(groupIdOrPath, samlGroupName, groupAccess.toValue(), memberRoleId);
1334+
}
1335+
13161336
/**
13171337
* Adds an SAML group link.
13181338
*
@@ -1324,9 +1344,25 @@ public void addSamlGroupLink(Object groupIdOrPath, String samlGroupName, AccessL
13241344
* @throws GitLabApiException if any exception occurs
13251345
*/
13261346
public void addSamlGroupLink(Object groupIdOrPath, String samlGroupName, Integer groupAccess) throws GitLabApiException {
1347+
addSamlGroupLink(groupIdOrPath, samlGroupName, groupAccess, null);
1348+
}
1349+
1350+
/**
1351+
* Adds an SAML group link.
1352+
*
1353+
* <pre><code>GitLab Endpoint: POST /groups/:id/saml_group_links</code></pre>
1354+
*
1355+
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
1356+
* @param samlGroupName the name of the SAML group
1357+
* @param groupAccess the minimum access level for members of the SAML group
1358+
* @param memberRoleId the id of the custom member role to assign
1359+
* @throws GitLabApiException if any exception occurs
1360+
*/
1361+
public void addSamlGroupLink(Object groupIdOrPath, String samlGroupName, Integer groupAccess, Integer memberRoleId) throws GitLabApiException {
13271362
GitLabApiForm formData = new GitLabApiForm()
13281363
.withParam("saml_group_name", samlGroupName, true)
1329-
.withParam("access_level", groupAccess, true);
1364+
.withParam("access_level", groupAccess, true)
1365+
.withParam("member_role_id", memberRoleId);
13301366
post(Response.Status.CREATED, formData, "groups", getGroupIdOrPath(groupIdOrPath), "saml_group_links");
13311367
}
13321368

@@ -1886,7 +1922,7 @@ public Group setGroupAvatar(Object groupIdOrPath, File avatarFile) throws GitLab
18861922
* Only working with GitLab 14.0 and above.
18871923
*
18881924
* <pre><code>GitLab Endpoint: GET /groups/:id/avatar</code></pre>
1889-
*
1925+
*
18901926
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
18911927
* @return an InputStream to read the raw file from
18921928
* @throws GitLabApiException if any exception occurs
@@ -2139,7 +2175,7 @@ public GroupAccessToken createGroupAccessToken(Object groupIdOrPath, String name
21392175
public GroupAccessToken rotateGroupAccessToken(Object groupIdOrPath, Long tokenId) throws GitLabApiException {
21402176
return rotateGroupAccessToken(groupIdOrPath, tokenId, null);
21412177
}
2142-
2178+
21432179

21442180
/**
21452181
* Rotate a group access token. Revokes the previous token and creates a new token that expires in one week.

src/main/java/org/gitlab4j/api/models/SamlGroupLink.java

+10
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ public class SamlGroupLink implements Serializable {
1212

1313
private AccessLevel accessLevel;
1414

15+
private int memberRoleId;
16+
1517
public String getName() {
1618
return name;
1719
}
@@ -28,6 +30,14 @@ public void setAccessLevel(AccessLevel aAccessLevel) {
2830
accessLevel = aAccessLevel;
2931
}
3032

33+
public int getMemberRoleId() {
34+
return memberRoleId;
35+
}
36+
37+
public void setMemberRoleId(int aMemberRoleId) {
38+
memberRoleId = aMemberRoleId;
39+
}
40+
3141
@Override
3242
public String toString() {
3343
return (JacksonJson.toJsonString(this));
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"access_level": 30,
3-
"name": "A_GITLAB_DEVELOPER"
3+
"name": "A_GITLAB_DEVELOPER",
4+
"member_role_id": 6
45
}

0 commit comments

Comments
 (0)