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
a260cd3d
Commit
a260cd3d
authored
May 09, 2018
by
Greg Messner
Browse files
Added updateUser() and javadoc cleanup.
parent
cabccb49
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/UserApi.java
View file @
a260cd3d
...
@@ -310,41 +310,40 @@ public class UserApi extends AbstractApi {
...
@@ -310,41 +310,40 @@ public class UserApi extends AbstractApi {
}
}
/**
/**
* Creates a new user. Note only administrators can create new users.
*
<p>
Creates a new user. Note only administrators can create new users.
* Either password or reset_password should be specified (reset_password takes priority).
* Either password or reset_password should be specified (reset_password takes priority).
*
*
* If both the User object's projectsLimit and the parameter projectsLimit is specified
* If both the User object's projectsLimit and the parameter projectsLimit is specified
* the parameter will take precedence.
* the parameter will take precedence.
</p>
*
*
* POST /users
*
<pre>
POST /users
</pre>
*
*
* email (required) - Email
* The following properties of the provided User instance can be set during creation:<pre><code> email (required) - Email
* password (optional) - Password
* reset_password (optional) - Send user password reset link - true or false(default)
* username (required) - Username
* username (required) - Username
* name (required) - Name
* name (required) - Name
* skype (optional) - Skype ID
* skype (optional) - Skype ID
* linkedin (optional) - LinkedIn
* linkedin (optional) - LinkedIn
* twitter (optional) - Twitter account
* twitter (optional) - Twitter account
* website
_u
rl (optional) - Website URL
* website
U
rl (optional) - Website URL
* organization (optional) - Organization name
* organization (optional) - Organization name
* projects
_l
imit (optional) - Number of projects user can create
* projects
L
imit (optional) - Number of projects user can create
* extern
_u
id (optional) - External UID
* extern
U
id (optional) - External UID
* provider (optional) - External provider name
* provider (optional) - External provider name
* bio (optional) - User's biography
* bio (optional) - User's biography
* location (optional) - User's location
* location (optional) - User's location
* admin (optional) - User is admin - true or false (default)
* admin (optional) - User is admin - true or false (default)
* can
_c
reate
_g
roup (optional) - User can create groups - true or false
* can
C
reate
G
roup (optional) - User can create groups - true or false
* skip
_c
onfirmation (optional) - Skip confirmation - true or false (default)
* skip
C
onfirmation (optional) - Skip confirmation - true or false (default)
* external (optional) - Flags the user as external - true or false(default)
* external (optional) - Flags the user as external - true or false(default)
*
avatar (optional) - Image file for user's avata
r
*
sharedRunnersMinutesLimit (optional) - Pipeline minutes quota for this use
r
*
shared_runners_minutes_limit (optional) - Pipeline minutes quota for this user
*
</code></pre>
*
*
* @param user the User instance with the user info to create
* @param user the User instance with the user info to create
* @param password the password for the new user
* @param password the password for the new user
* @param projectsLimit the maximum number of project
* @param projectsLimit the maximum number of project
* @return created User instance
* @return created User instance
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
* @deprecated Will be removed in version 5.0, replaced by {@link #createUser(User, CharSequence, boolean)}
*/
*/
public
User
createUser
(
User
user
,
CharSequence
password
,
Integer
projectsLimit
)
throws
GitLabApiException
{
public
User
createUser
(
User
user
,
CharSequence
password
,
Integer
projectsLimit
)
throws
GitLabApiException
{
Form
formData
=
userToForm
(
user
,
projectsLimit
,
password
,
null
,
true
);
Form
formData
=
userToForm
(
user
,
projectsLimit
,
password
,
null
,
true
);
...
@@ -353,34 +352,30 @@ public class UserApi extends AbstractApi {
...
@@ -353,34 +352,30 @@ public class UserApi extends AbstractApi {
}
}
/**
/**
* Creates a new user. Note only administrators can create new users.
* <p>Creates a new user. Note only administrators can create new users.
* Either password or reset_password should be specified (reset_password takes priority).
* Either password or resetPassword should be specified (resetPassword takes priority).</p>
*
* Creates a user with reset_password being <code>true</code>
*
*
* POST /users
*
<pre>
POST /users
</pre>
*
*
* email (required) - Email
* The following properties of the provided User instance can be set during creation:<pre><code> email (required) - Email
* password (optional) - Password
* reset_password (optional) - Send user password reset link - true or false(default)
* username (required) - Username
* username (required) - Username
* name (required) - Name
* name (required) - Name
* skype (optional) - Skype ID
* skype (optional) - Skype ID
* linkedin (optional) - LinkedIn
* linkedin (optional) - LinkedIn
* twitter (optional) - Twitter account
* twitter (optional) - Twitter account
* website
_u
rl (optional) - Website URL
* website
U
rl (optional) - Website URL
* organization (optional) - Organization name
* organization (optional) - Organization name
* projects
_l
imit (optional) - Number of projects user can create
* projects
L
imit (optional) - Number of projects user can create
* extern
_u
id (optional) - External UID
* extern
U
id (optional) - External UID
* provider (optional) - External provider name
* provider (optional) - External provider name
* bio (optional) - User's biography
* bio (optional) - User's biography
* location (optional) - User's location
* location (optional) - User's location
* admin (optional) - User is admin - true or false (default)
* admin (optional) - User is admin - true or false (default)
* can
_c
reate
_g
roup (optional) - User can create groups - true or false
* can
C
reate
G
roup (optional) - User can create groups - true or false
* skip
_c
onfirmation (optional) - Skip confirmation - true or false (default)
* skip
C
onfirmation (optional) - Skip confirmation - true or false (default)
* external (optional) - Flags the user as external - true or false(default)
* external (optional) - Flags the user as external - true or false(default)
*
avatar (optional) - Image file for user's avata
r
*
sharedRunnersMinutesLimit (optional) - Pipeline minutes quota for this use
r
*
shared_runners_minutes_limit (optional) - Pipeline minutes quota for this user
*
</code></pre>
*
*
* @param user the User instance with the user info to create
* @param user the User instance with the user info to create
* @param password the password for the new user
* @param password the password for the new user
...
@@ -394,38 +389,75 @@ public class UserApi extends AbstractApi {
...
@@ -394,38 +389,75 @@ public class UserApi extends AbstractApi {
return
(
response
.
readEntity
(
User
.
class
));
return
(
response
.
readEntity
(
User
.
class
));
}
}
/**
* <p>Modifies an existing user. Only administrators can change attributes of a user.</p>
*
* <pre>PUT /users</pre>
*
* The following properties of the provided User instance can be set during update:<pre><code> email (required) - Email
* username (required) - Username
* name (required) - Name
* skype (optional) - Skype ID
* linkedin (optional) - LinkedIn
* twitter (optional) - Twitter account
* websiteUrl (optional) - Website URL
* organization (optional) - Organization name
* projectsLimit (optional) - Number of projects user can create
* externUid (optional) - External UID
* provider (optional) - External provider name
* bio (optional) - User's biography
* location (optional) - User's location
* admin (optional) - User is admin - true or false (default)
* canCreateGroup (optional) - User can create groups - true or false
* skipConfirmation (optional) - Skip confirmation - true or false (default)
* external (optional) - Flags the user as external - true or false(default)
* sharedRunnersMinutesLimit (optional) - Pipeline minutes quota for this user
*</code></pre>
*
* @param user the User instance with the user info to modify
* @param password the new password for the user
* @return the modified User instance
* @throws GitLabApiException if any exception occurs
*/
public
User
updateUser
(
User
user
,
CharSequence
password
)
throws
GitLabApiException
{
Form
form
=
userToForm
(
user
,
null
,
password
,
false
,
false
);
Response
response
=
put
(
Response
.
Status
.
OK
,
form
.
asMap
(),
"users"
,
user
.
getId
());
return
(
response
.
readEntity
(
User
.
class
));
}
/**
/**
* Modifies an existing user. Only administrators can change attributes of a user.
* Modifies an existing user. Only administrators can change attributes of a user.
*
*
* PUT /users/:id
* <pre>PUT /users/:id</pre>
*
*
* email - Email
* The following properties of the provided User instance can be set during update:<pre><code> email (required) - Email
* username - Username
* username (required) - Username
* name - Name
* name (required) - Name
* password - Password
* skype (optional) - Skype ID
* skype - Skype ID
* linkedin (optional) - LinkedIn
* linkedin - LinkedIn
* twitter (optional) - Twitter account
* twitter - Twitter account
* websiteUrl (optional) - Website URL
* website_url - Website URL
* organization (optional) - Organization name
* organization - Organization name
* projectsLimit (optional) - Number of projects user can create
* projects_limit - Limit projects each user can create
* externUid (optional) - External UID
* extern_uid - External UID
* provider (optional) - External provider name
* provider - External provider name
* bio (optional) - User's biography
* bio - User's biography
* location (optional) - User's location
* location (optional) - User's location
* admin (optional) - User is admin - true or false (default)
* admin (optional) - User is admin - true or false (default)
* can
_c
reate
_g
roup (optional) - User can create groups - true or false
* can
C
reate
G
roup (optional) - User can create groups - true or false
* skip
_rec
onfirmation (optional) - Skip
re
confirmation - true or false (default)
* skip
C
onfirmation (optional) - Skip confirmation - true or false (default)
* external (optional) - Flags the user as external - true or false(default)
* external (optional) - Flags the user as external - true or false(default)
* shared
_r
unners
_m
inutes
_l
imit (optional) - Pipeline minutes quota for this user
* shared
R
unners
M
inutes
L
imit (optional) - Pipeline minutes quota for this user
*
avatar (optional) - Image file for user's avatar
*
</code></pre>
*
*
* @param user the User instance with the user info to modify
* @param user the User instance with the user info to modify
* @param password the new password for the user
* @param password the new password for the user
* @param projectsLimit the maximum number of project
* @param projectsLimit the maximum number of project
* @return the modified User instance
* @return the modified User instance
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
* @deprecated Will be removed in version 5.0, replaced by {@link #updateUser(User, CharSequence)}
*/
*/
@Deprecated
public
User
modifyUser
(
User
user
,
CharSequence
password
,
Integer
projectsLimit
)
throws
GitLabApiException
{
public
User
modifyUser
(
User
user
,
CharSequence
password
,
Integer
projectsLimit
)
throws
GitLabApiException
{
Form
form
=
userToForm
(
user
,
projectsLimit
,
password
,
false
,
false
);
Form
form
=
userToForm
(
user
,
projectsLimit
,
password
,
false
,
false
);
Response
response
=
put
(
Response
.
Status
.
OK
,
form
.
asMap
(),
"users"
,
user
.
getId
());
Response
response
=
put
(
Response
.
Status
.
OK
,
form
.
asMap
(),
"users"
,
user
.
getId
());
...
...
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