Package org.opennebula.client.user
Class User
java.lang.Object
org.opennebula.client.PoolElement
org.opennebula.client.user.User
This class represents an OpenNebula User.
It also offers static XML-RPC call wrappers.
-
Field Summary
Fields inherited from class org.opennebula.client.PoolElement
client, id, xml, xpath
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddgroup
(int gid) Adds the User to a secondary groupstatic OneResponse
Adds the User to a secondary groupstatic OneResponse
Allocates a new user in OpenNebula.static OneResponse
Allocates a new user in OpenNebula.Changes the auth driver of the given userChanges the auth driver and the password of the given userstatic OneResponse
Changes the auth driver and the password of the given userchgrp
(int gid) Changes the main group of the given userstatic OneResponse
Changes the main group of the given userdelete()
Deletes the user from OpenNebula.static OneResponse
Deletes a user from OpenNebula.delgroup
(int gid) Removes the User from a secondary group.static OneResponse
Removes the User from a secondary group.enable
(boolean enable) Enables or disables a Userstatic OneResponse
Enables or disables a Userinfo()
Loads the xml representation of the user.static OneResponse
Retrieves the information of the given user.static OneResponse
Retrieves the information of the given User.boolean
Returns true if the user is enabled.Sets the LOGIN_TOKEN for the user.Sets the LOGIN_TOKEN for the user.static OneResponse
Sets the LOGIN_TOKEN for the userstatic OneResponse
Sets the LOGIN_TOKEN for the userChanges the password for the user.static OneResponse
Changes the password for the given user.Replaces the user quota template contents.static OneResponse
Replaces the user quota template contents.Replaces the user template contents.Replaces the user template contents.static OneResponse
Replaces the user template contents.
-
Constructor Details
-
User
Creates a new User representation.- Parameters:
id
- The user id (uid).client
- XML-RPC Client.
-
User
- See Also:
-
-
Method Details
-
allocate
Allocates a new user in OpenNebula.- Parameters:
client
- XML-RPC Client.username
- Username for the new user.password
- Password for the new user- Returns:
- If successful the message contains the associated id (int uid) generated for this user.
-
allocate
public static OneResponse allocate(Client client, String username, String password, String auth, Integer[] gids) Allocates a new user in OpenNebula.- Parameters:
client
- XML-RPC Client.username
- Username for the new user.password
- Password for the new userauth
- Auth driver for the new user.gids
- Group IDs. The first ID will be used as the main group. This array can be empty, in which case the default group will be used.- Returns:
- If successful the message contains the associated id (int uid) generated for this user.
-
info
Retrieves the information of the given user.- Parameters:
client
- XML-RPC Client.id
- The user id (uid) for the user to retrieve the information from.- Returns:
- if successful the message contains the string with the information about the user returned by OpenNebula.
-
info
Retrieves the information of the given User.- Parameters:
client
- XML-RPC Client.id
- The User id for the User to retrieve the information fromdecrypt
- If true decrypt sensitive attributes- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
delete
Deletes a user from OpenNebula.- Parameters:
client
- XML-RPC Client.id
- The user id (uid) of the target user we want to delete.- Returns:
- If an error occurs the error message contains the reason.
-
passwd
Changes the password for the given user.- Parameters:
client
- XML-RPC Client.id
- The user id (uid) of the target user we want to modify.password
- The new password.- Returns:
- If an error occurs the error message contains the reason.
-
chgrp
Changes the main group of the given user- Parameters:
client
- XML-RPC Client.id
- The user id (uid) of the target user we want to modify.gid
- The new group ID.- Returns:
- If an error occurs the error message contains the reason.
-
addgroup
Adds the User to a secondary group- Parameters:
client
- XML-RPC Client.id
- The user id (uid) of the target user we want to modify.gid
- The new group ID.- Returns:
- If an error occurs the error message contains the reason.
-
delgroup
Removes the User from a secondary group. Fails if the group is the main one- Parameters:
client
- XML-RPC Client.id
- The user id (uid) of the target user we want to modify.gid
- The group ID.- Returns:
- If an error occurs the error message contains the reason.
-
chauth
Changes the auth driver and the password of the given user- Parameters:
client
- XML-RPC Client.id
- The user id (uid) of the target user we want to modify.auth
- The new auth driver.password
- The new password. If it is an empty string, the user password is not changed- Returns:
- If an error occurs the error message contains the reason.
-
update
Replaces the user template contents.- Parameters:
client
- XML-RPC Client.id
- The user id of the target user we want to modify.new_template
- New template contents.append
- True to append new attributes instead of replace the whole template- Returns:
- If successful the message contains the user id.
-
setQuota
Replaces the user quota template contents.- Parameters:
client
- XML-RPC Client.id
- The user id of the target user we want to modify.quota_template
- New quota template contents.- Returns:
- If successful the message contains the user id.
-
login
Sets the LOGIN_TOKEN for the user- Parameters:
client
- XML-RPC Client.username
- of the usertoken
- the login token, if empty OpenNebula will generate oneexpire
- valid period of the token in secs. If <= 0 the token will be reset- Returns:
- token in case of success, Error otherwise
-
login
Sets the LOGIN_TOKEN for the user- Parameters:
client
- XML-RPC Client.username
- of the usertoken
- the login token, if empty OpenNebula will generate oneexpire
- valid period of the token in secs. If <= 0 the token will be resetegid
- effective GID to use with this token. To use the current GID and user groups set it to -1- Returns:
- token in case of success, Error otherwise
-
enable
Enables or disables a User- Parameters:
client
- XML-RPC Client.id
- The user id of the target user we want to modify.enable
- True for enabling, false for disabling.- Returns:
- If successful the message contains the User id.
-
info
Loads the xml representation of the user. The info is also stored internally.- See Also:
-
delete
Deletes the user from OpenNebula.- See Also:
-
passwd
Changes the password for the user.- Parameters:
password
- The new password.- Returns:
- If an error occurs the error message contains the reason.
-
chgrp
Changes the main group of the given user- Parameters:
gid
- The new group ID.- Returns:
- If an error occurs the error message contains the reason.
-
addgroup
Adds the User to a secondary group- Parameters:
gid
- The new group ID.- Returns:
- If an error occurs the error message contains the reason.
-
delgroup
Removes the User from a secondary group. Fails if the group is the main one- Parameters:
gid
- The group ID.- Returns:
- If an error occurs the error message contains the reason.
-
chauth
Changes the auth driver and the password of the given user- Parameters:
auth
- The new auth driver.password
- The new password. If it is an empty string, the user password is not changed- Returns:
- If an error occurs the error message contains the reason.
-
chauth
Changes the auth driver of the given user- Parameters:
auth
- The new auth driver.- Returns:
- If an error occurs the error message contains the reason.
-
update
Replaces the user template contents.- Parameters:
new_template
- New template contents.- Returns:
- If successful the message contains the user id.
-
update
Replaces the user template contents.- Parameters:
new_template
- New template contents.append
- True to append new attributes instead of replace the whole template- Returns:
- If successful the message contains the user id.
-
setQuota
Replaces the user quota template contents.- Parameters:
quota_template
- New quota template contents.- Returns:
- If successful the message contains the user id.
-
login
Sets the LOGIN_TOKEN for the user. The method info() must be called before.- Parameters:
token
- the login token, if empty OpenNebula will generate oneexpire
- valid period of the token in secs. If <= 0 the token will be reset- Returns:
- token in case of success, Error otherwise
-
login
Sets the LOGIN_TOKEN for the user. The method info() must be called before.- Parameters:
token
- the login token, if empty OpenNebula will generate oneexpire
- valid period of the token in secs. If <= 0 the token will be resetegid
- effective GID to use with this token. To use the current GID and user groups set it to -1- Returns:
- token in case of success, Error otherwise
-
enable
Enables or disables a User- Parameters:
enable
- True for enabling, false for disabling.- Returns:
- If successful the message contains the User id.
-
isEnabled
public boolean isEnabled()Returns true if the user is enabled.- Returns:
- True if the user is enabled.
-