Constructor. Developers need not invoke the UserAccount constructor directly; Orbiter automatically creates UserAccount objects when clients login.
Adds a new security role to the account.
The desired new role. For a list of built-in security roles, see the SecurityRole class.
Changes the account's password.
The desired new account password. Must not be null.
The current account password. If no password is supplied, the password will be changed if the client requesting the change has sufficient privileges only.
Deletes an attribute from this user account.
Retrieves a persistent client attribute. This UserAccount's persistent attributes are available only when this UserAccount is synchronized with the state of the server.
To synchronize an account, the current client must do one of the following:
For general details on retrieving attributes, see the Client.getAttribute method.
Returns an object containing all attributes for this user account. The object's structure matches that of the analogous Client.getAttributes.
Returns an object containing the names and values of all attributes defined on this UserAccount instance for a given scope, or for all scopes. The object's structure matches that of the analogous Client.getAttributesByScope.
Returns a reference to this account's Client object, which is available if this account is logged in only.
Indicates whether this UserAccount is currently logged in.
An integer corresponding to one of the following three constants: ConnectionState.LOGGED_IN, ConnectionState.NOT_CONNECTED, or ConnectionState.UNKNOWN.
Returns the internal Client object for this account's corresponding client. This method is required when an application wishes to access the composed Client object reference for a client with a custom client class. For details, see the ClientManager.getInternalClient method.
Returns this account's userID.
Returns true if this user account's connection state is ConnectionState.LOGGED_IN; false otherwise.
Returns a Boolean indicating whether the account has moderator privileges. To assign moderator privileges to an account, use addRole().
true if the account has moderator privileges, false otherwise.
Returns true if the current client is logged in under this UserAccount.
Logs off this user account. The result of the attempt is returned via an AccountEvent.LOGOFF_RESULT event. If the attempt succeeds, the UserAccount object triggers an AccountEvent.LOGOFF event and the corresponding client is then automatically disconnected by Union Server.
The account's password. If no password is supplied, the account will be logged off if the client requesting the logoff has sufficient privileges only.
Asks the server to notify the current client any time this UserAccount's state changes. For complete details, see the AccountManager's observeAccount() method.
Removes a security role from the account.
Assigns an account attribute that is stored persistently on the server under this user account.
Note that a logged-in client's attribute names do not conflict with its account attribute names. For example, a client might define an attribute "score" on itself and also on its user account. The two attributes are considered separate; each can have its own value.
For general details on assigning attributes, see the Client.setAttribute method.
Asks the server to stop observing this UserAccount. As a result, the server will no longer send notifications when the UserAccount's state changes.
Results of a stopObserving() call are returned via a AccountEvent.STOP_OBSERVING_RESULT event. If the call succeeds, the AccountEvent.STOP_OBSERVING event is also triggered.
The UserAccount class represents a Union user account. Each user account can save information in persistent attributes, which are stored in a server-side database or other custom datasource. User accounts are created with the AccountManager class's createAccount() method. Clients login to user accounts via the AccountManager class's login() method. When a client logs in, its Client object is linked with a UserAccount object. To access the account's events and data, use the Client class's getAccount() method, which returns a UserAccount object.
When a client logs into an account, that account's global attributes are loaded automatically, and are immediately available via UserAccount's getAttribute() method. Account attributes scoped to a room are loaded automatically when the logged-in client joins or observes that room.
To access the list of UserAccount objects known to the current client, use the AccountManager class's getAccounts() method.