Unverified Commit 6a3839bc authored by Jérémie Bresson's avatar Jérémie Bresson Committed by GitHub
Browse files

Add "approve" and "reject" user methods (#1007)

Fixes #1006
parent a3ab79b2
...@@ -169,6 +169,36 @@ public class UserApi extends AbstractApi { ...@@ -169,6 +169,36 @@ public class UserApi extends AbstractApi {
return (getActiveUsers(getDefaultPerPage()).stream()); return (getActiveUsers(getDefaultPerPage()).stream());
} }
/**
* Approves the specified user. Available only for admin.
*
* <pre><code>GitLab Endpoint: POST /users/:id/approve</code></pre>
*
* @param userId the ID of the user to approve
* @throws GitLabApiException if any exception occurs
*/
public void approveUser(Long userId) throws GitLabApiException {
if (userId == null) {
throw new RuntimeException("userId cannot be null");
}
post(Response.Status.CREATED, (Form) null, "users", userId, "approve");
}
/**
* Rejects specified user that is pending approval. Available only for administrators.
*
* <pre><code>GitLab Endpoint: POST /users/:id/reject</code></pre>
*
* @param userId the ID of the user to reject
* @throws GitLabApiException if any exception occurs
*/
public void rejectUser(Long userId) throws GitLabApiException {
if (userId == null) {
throw new RuntimeException("userId cannot be null");
}
post(Response.Status.OK, (Form) null, "users", userId, "reject");
}
/** /**
* Blocks the specified user. Available only for admin. * Blocks the specified user. Available only for admin.
* *
......
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