Unverified Commit a3ab79b2 authored by Henry's avatar Henry Committed by GitHub
Browse files

Added support for listing LDAP group links (#1015)



Co-authored-by: default avatarJan Henrik Wiesner <jan.wiesner@gebit.de>
Co-authored-by: default avatarJeremie Bresson <jeremie.bresson@unblu.com>
parent c393d438
...@@ -22,6 +22,7 @@ import org.gitlab4j.api.models.Group; ...@@ -22,6 +22,7 @@ import org.gitlab4j.api.models.Group;
import org.gitlab4j.api.models.GroupFilter; import org.gitlab4j.api.models.GroupFilter;
import org.gitlab4j.api.models.GroupParams; import org.gitlab4j.api.models.GroupParams;
import org.gitlab4j.api.models.GroupProjectsFilter; import org.gitlab4j.api.models.GroupProjectsFilter;
import org.gitlab4j.api.models.LdapGroupLink;
import org.gitlab4j.api.models.Member; import org.gitlab4j.api.models.Member;
import org.gitlab4j.api.models.Project; import org.gitlab4j.api.models.Project;
import org.gitlab4j.api.models.Variable; import org.gitlab4j.api.models.Variable;
...@@ -1177,6 +1178,20 @@ public class GroupApi extends AbstractApi { ...@@ -1177,6 +1178,20 @@ public class GroupApi extends AbstractApi {
post(Response.Status.NO_CONTENT, (Form)null, "groups", getGroupIdOrPath(groupIdOrPath), "ldap_sync"); post(Response.Status.NO_CONTENT, (Form)null, "groups", getGroupIdOrPath(groupIdOrPath), "ldap_sync");
} }
/**
* Get the list of LDAP group links.
*
* <pre><code>GitLab Endpoint: GET /groups/:id/ldap_group_links</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @return a list of LDAP group links
* @throws GitLabApiException if any exception occurs
*/
public List<LdapGroupLink> getLdapGroupLinks(Object groupIdOrPath) throws GitLabApiException {
Response response = get(Response.Status.OK, null, "groups", getGroupIdOrPath(groupIdOrPath), "ldap_group_links");
return (response.readEntity(new GenericType<List<LdapGroupLink>>() {}));
}
/** /**
* Adds an LDAP group link. * Adds an LDAP group link.
* *
......
package org.gitlab4j.api.models;
import org.gitlab4j.api.utils.JacksonJson;
public class LdapGroupLink {
private String cn;
private AccessLevel groupAccess;
private String provider;
private String filter;
public String getCn() {
return cn;
}
public void setCn(String aCn) {
cn = aCn;
}
public AccessLevel getGroupAccess() {
return groupAccess;
}
public void setGroupAccess(AccessLevel aGroupAccess) {
groupAccess = aGroupAccess;
}
public String getProvider() {
return provider;
}
public void setProvider(String aProvider) {
provider = aProvider;
}
public String getFilter() {
return filter;
}
public void setFilter(String aFilter) {
filter = aFilter;
}
@Override
public String toString() {
return (JacksonJson.toJsonString(this));
}
}
...@@ -81,6 +81,7 @@ import org.gitlab4j.api.models.Job; ...@@ -81,6 +81,7 @@ import org.gitlab4j.api.models.Job;
import org.gitlab4j.api.models.Key; import org.gitlab4j.api.models.Key;
import org.gitlab4j.api.models.Label; import org.gitlab4j.api.models.Label;
import org.gitlab4j.api.models.LabelEvent; import org.gitlab4j.api.models.LabelEvent;
import org.gitlab4j.api.models.LdapGroupLink;
import org.gitlab4j.api.models.Link; import org.gitlab4j.api.models.Link;
import org.gitlab4j.api.models.Member; import org.gitlab4j.api.models.Member;
import org.gitlab4j.api.models.MergeRequest; import org.gitlab4j.api.models.MergeRequest;
...@@ -771,6 +772,12 @@ public class TestGitLabApiBeans { ...@@ -771,6 +772,12 @@ public class TestGitLabApiBeans {
assertTrue(compareJson(labels, "labels.json")); assertTrue(compareJson(labels, "labels.json"));
} }
@Test
public void testLdapGroupLink() throws Exception {
LdapGroupLink link = unmarshalResource(LdapGroupLink.class, "ldap-group-link.json");
assertTrue(compareJson(link, "ldap-group-link.json"));
}
@Test @Test
public void testSearchBlobs() throws Exception { public void testSearchBlobs() throws Exception {
List<SearchBlob> searchResults = unmarshalResourceList(SearchBlob.class, "wiki-blobs.json"); List<SearchBlob> searchResults = unmarshalResourceList(SearchBlob.class, "wiki-blobs.json");
......
{
"cn": "My Group",
"group_access": 30,
"provider": "tertiary",
"filter": "(employeeType=developer)"
}
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