Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
6a3839bc
Unverified
Commit
6a3839bc
authored
Aug 17, 2023
by
Jérémie Bresson
Committed by
GitHub
Aug 17, 2023
Browse files
Add "approve" and "reject" user methods (#1007)
Fixes #1006
parent
a3ab79b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/UserApi.java
View file @
6a3839bc
...
...
@@ -169,6 +169,36 @@ public class UserApi extends AbstractApi {
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.
*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment