Commit b1bb369b authored by Jeremie Bresson's avatar Jeremie Bresson
Browse files

Merge remote-tracking branch 'origin/main' into 6.x

parents aac8235d a7fe8665
......@@ -1313,6 +1313,26 @@ public class GroupApi extends AbstractApi {
addSamlGroupLink(groupIdOrPath, samlGroupName, groupAccess.toValue());
}
/**
* Adds an SAML group link.
*
* <pre><code>GitLab Endpoint: POST /groups/:id/saml_group_links</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param samlGroupName the name of the SAML group
* @param groupAccess the minimum access level for members of the SAML group
* @param memberRoleId the id of the custom member role to assign
* @throws GitLabApiException if any exception occurs
*/
public void addSamlGroupLink(Object groupIdOrPath, String samlGroupName, AccessLevel groupAccess, int memberRoleId) throws GitLabApiException {
if (groupAccess == null) {
throw new RuntimeException("groupAccess cannot be null or empty");
}
addSamlGroupLink(groupIdOrPath, samlGroupName, groupAccess.toValue(), memberRoleId);
}
/**
* Adds an SAML group link.
*
......@@ -1324,9 +1344,25 @@ public class GroupApi extends AbstractApi {
* @throws GitLabApiException if any exception occurs
*/
public void addSamlGroupLink(Object groupIdOrPath, String samlGroupName, Integer groupAccess) throws GitLabApiException {
addSamlGroupLink(groupIdOrPath, samlGroupName, groupAccess, null);
}
/**
* Adds an SAML group link.
*
* <pre><code>GitLab Endpoint: POST /groups/:id/saml_group_links</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param samlGroupName the name of the SAML group
* @param groupAccess the minimum access level for members of the SAML group
* @param memberRoleId the id of the custom member role to assign
* @throws GitLabApiException if any exception occurs
*/
public void addSamlGroupLink(Object groupIdOrPath, String samlGroupName, Integer groupAccess, Integer memberRoleId) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("saml_group_name", samlGroupName, true)
.withParam("access_level", groupAccess, true);
.withParam("access_level", groupAccess, true)
.withParam("member_role_id", memberRoleId);
post(Response.Status.CREATED, formData, "groups", getGroupIdOrPath(groupIdOrPath), "saml_group_links");
}
......@@ -1886,7 +1922,7 @@ public class GroupApi extends AbstractApi {
* Only working with GitLab 14.0 and above.
*
* <pre><code>GitLab Endpoint: GET /groups/:id/avatar</code></pre>
*
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @return an InputStream to read the raw file from
* @throws GitLabApiException if any exception occurs
......@@ -2139,7 +2175,7 @@ public class GroupApi extends AbstractApi {
public GroupAccessToken rotateGroupAccessToken(Object groupIdOrPath, Long tokenId) throws GitLabApiException {
return rotateGroupAccessToken(groupIdOrPath, tokenId, null);
}
/**
* Rotate a group access token. Revokes the previous token and creates a new token that expires in one week.
......
......@@ -12,6 +12,8 @@ public class SamlGroupLink implements Serializable {
private AccessLevel accessLevel;
private int memberRoleId;
public String getName() {
return name;
}
......@@ -28,6 +30,14 @@ public class SamlGroupLink implements Serializable {
accessLevel = aAccessLevel;
}
public int getMemberRoleId() {
return memberRoleId;
}
public void setMemberRoleId(int aMemberRoleId) {
memberRoleId = aMemberRoleId;
}
@Override
public String toString() {
return (JacksonJson.toJsonString(this));
......
{
"access_level": 30,
"name": "A_GITLAB_DEVELOPER"
"name": "A_GITLAB_DEVELOPER",
"member_role_id": 6
}
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