Clearspace API (1.10.16) Core Javadocs

com.jivesoftware.base
Interface User

All Superinterfaces:
JiveObject
All Known Subinterfaces:
IntrospectiveUser

public interface User
extends JiveObject

The User interface provides information about and services for users of the system. Users can be identified by a unique id or username. Users can also be organized into groups for easier management of permissions.

The name and email field will normally be required fields when creating user accounts for most implementations. However, some users may wish to keep that information private. Therefore, there are two flags to set if the name and email fields should be made visible to other users. If the flags are set to deny access, getName() and getEmail() will throw UnauthorizedExceptions to users that don't have administrator permissions.

Security for User objects is provide by UserProxy protection proxy objects.

Instructions for those that wish to implement this interface to provide a custom User implementation appear in red.

See Also:
Group

Method Summary
 java.util.Date getCreationDate()
          Returns the date that the user was created.
 java.lang.String getEmail()
          Returns the user's email address.
 long getID()
          Returns the user's id.
 java.util.Date getLastLoggedIn()
          Returns the date the user last logged in.
 java.util.Date getModificationDate()
          Returns the date that the user was last modified.
 java.lang.String getName()
          Returns the user's name.
 java.lang.String getPasswordHash()
          Returns the user's password in hashed form.
 Permissions getPermissions(AuthToken authToken)
          Returns the permissions for the user that correspond to the passed-in AuthToken.
 java.util.Map<java.lang.String,java.lang.String> getProperties()
          Retrieve a map of all the extended properties for the user.
 java.lang.String getUsername()
          Returns the user's username.
 boolean isAuthorized(long permissionType)
          Returns true if the handle on the object has the permission specified.
 boolean isEmailVisible()
          Returns true if the user has chosen to make her email visible to other users.
 boolean isEnabled()
          Returns true if the user is disabled, meaning they cannot log in.
 boolean isNameVisible()
          Returns true if the user has chosen to make her name visible to other users.
 void setCreationDate(java.util.Date creationDate)
          Sets the creation date of the user.
 void setEmail(java.lang.String email)
          Sets the user's email address.
 void setEmailVisible(boolean visible)
          Sets whether a user's email is visible to other users.
 void setEnabled(boolean enabled)
          If this field is set to false the user is disabled, meaning they cannot log in.
 void setLastLoggedIn(java.util.Date date)
          Sets the date the user last logged in.
 void setModificationDate(java.util.Date modificationDate)
          Sets the date the user was last modified.
 void setName(java.lang.String name)
          Sets the user's name.
 void setNameVisible(boolean visible)
          Sets whether a user's name is visible to other users.
 void setPassword(java.lang.String password)
          Sets the users's password.
 void setPasswordHash(java.lang.String passwordHash)
          Sets the user's password in hashed form.
 void setUsername(java.lang.String username)
          Sets the user's name.
 
Methods inherited from interface com.jivesoftware.community.JiveObject
getObjectType
 

Method Detail

getID

long getID()
Returns the user's id. All ids must be unique in the system.

Specified by:
getID in interface JiveObject
Returns:
the user's id.

getUsername

java.lang.String getUsername()
Returns the user's username. All usernames must be unique in the system.

Returns:
the username of the user.

setUsername

void setUsername(java.lang.String username)
                 throws UnauthorizedException,
                        UserAlreadyExistsException
Sets the user's name. All usernames must be unique in the system.

Parameters:
username - new username for the user.
Throws:
UnauthorizedException - if does not have administrator permissions.
UserAlreadyExistsException - if the username is taken by another user.

getName

java.lang.String getName()
Returns the user's name. The user's name does not have to be to be unique in the system. Some users may opt to not let others see their name for privacy reasons. In that case, the user can set nameVisible to false. In that case, a call to this method will return null.

Returns:
the name of the user.

setName

void setName(java.lang.String name)
             throws UnauthorizedException
Sets the user's name. The user's name does not have to be to be unique in the system.

Parameters:
name - new name for the user.
Throws:
UnauthorizedException - if does not have administrator permissions.

isNameVisible

boolean isNameVisible()
Returns true if the user has chosen to make her name visible to other users. If the name is not visible, calling getName() will throw an UnauthorizedException.

Returns:
true if the name is visible to other users.

setNameVisible

void setNameVisible(boolean visible)
                    throws UnauthorizedException
Sets whether a user's name is visible to other users. If the field is set to not be visible, calling getName() will throw an UnauthorizedException.

Parameters:
visible - boolean value to determin if the name should be visible.
Throws:
UnauthorizedException - if does not have administrator permissions.

setPassword

void setPassword(java.lang.String password)
                 throws UnauthorizedException
Sets the users's password. The password should be passed in as plain text. The way the password is stored is implementation dependent. However, it is recommended to at least hash passwords with an algorithm such as MD5.

Parameters:
password - new password for the user.
Throws:
UnauthorizedException - if does not have administrator permissions.

getPasswordHash

java.lang.String getPasswordHash()
                                 throws UnauthorizedException
Returns the user's password in hashed form. This method is only intended for system administration functions and can be ignored by skin writers.

If your back-end user store does not support this operation, throw an UnsupportedOperationException.

Returns:
the hashed password.
Throws:
UnauthorizedException - if does not have administrator permissions.

setPasswordHash

void setPasswordHash(java.lang.String passwordHash)
                     throws UnauthorizedException
Sets the user's password in hashed form. This method is only intended for system administration functions and can be ignored by skin writers.

If your back-end user store does not support this operation, throw an UnsupportedOperationException.

Parameters:
passwordHash - the hashedPassword for the user.
Throws:
UnauthorizedException - if does not have administrator permissions.

getEmail

java.lang.String getEmail()
Returns the user's email address. Email should be considered to be a required field of a user account since it is critical to many user operations performing. If the user sets emailVisible to false, this method will always return null.

If your back-end user store does not support this operation, always return null.

Returns:
the email address of the user.

setEmail

void setEmail(java.lang.String email)
              throws UnauthorizedException
Sets the user's email address. Email should be considered to be a required field of a user account since it is critical to many user operations performing.

If your back-end user store does not support this operation, throw an UnsupportedOperationException.

Parameters:
email - new email address for the user.
Throws:
UnauthorizedException - if does not have administrator permissions.

isEmailVisible

boolean isEmailVisible()
Returns true if the user has chosen to make her email visible to other users. If the email field is not visible, calling getEmail() will throw an UnauthorizedException.

Returns:
true if the name is visible to other users.

setEmailVisible

void setEmailVisible(boolean visible)
                     throws UnauthorizedException
Sets whether a user's email is visible to other users. If the field is set to not be visible, calling getEmail() will throw an UnauthorizedException.

Parameters:
visible - boolean value to determin if the name should be visible.
Throws:
UnauthorizedException - if does not have administrator permissions.

getCreationDate

java.util.Date getCreationDate()
Returns the date that the user was created.

If your back-end user store does not support this operation, throw an UnsupportedOperationException.

Returns:
the date the user was created.

setCreationDate

void setCreationDate(java.util.Date creationDate)
                     throws UnauthorizedException
Sets the creation date of the user. In most cases, the creation date will default to when the user was entered into the system. However, the date needs to be set manually when importing data. In other words, skin authors should ignore this method since it only intended for system maintenance.

Parameters:
creationDate - the date the user was created.
Throws:
UnauthorizedException - if does not have administrator permissions.

getModificationDate

java.util.Date getModificationDate()
Returns the date that the user was last modified.

Returns:
the date the user record was last modified.

setModificationDate

void setModificationDate(java.util.Date modificationDate)
                         throws UnauthorizedException
Sets the date the user was last modified. Skin authors should ignore this method since it only intended for system maintenance.

Parameters:
modificationDate - the date the user was modified.
Throws:
UnauthorizedException - if does not have administrator permissions.

getProperties

java.util.Map<java.lang.String,java.lang.String> getProperties()
Retrieve a map of all the extended properties for the user. Each user can have an arbitrary number of extended properties. This allows for enhanced functionality that is not part of the base interface. The map is alterable if the user is authorized to modify the user. Null keys and values are not allowed.

If the user is not authorized to modify the user any method which modifies the map will fail with a UnsupportedOperationException;

Returns:
a map of user extended properties.

getPermissions

Permissions getPermissions(AuthToken authToken)
Returns the permissions for the user that correspond to the passed-in AuthToken.

Parameters:
authToken - the auth token to look up permissions with.
Returns:
The permissions for the auth token.

isAuthorized

boolean isAuthorized(long permissionType)
Returns true if the handle on the object has the permission specified. A list of possible permissions can be found in the Permissions class. Certain methods of this class are restricted to certain permissions as specified in the method comments.

Because proxy objects will implement real security checking, this method should be implemented as:
return true;
.

Parameters:
permissionType - the permission to check for.
Returns:
True if the user is authorized.
See Also:
Permissions

setLastLoggedIn

void setLastLoggedIn(java.util.Date date)
Sets the date the user last logged in. This method should only be called by jive internals.

Parameters:
date - the date the user last logged in.

getLastLoggedIn

java.util.Date getLastLoggedIn()
Returns the date the user last logged in.

Returns:
the date the user last logged in.

setEnabled

void setEnabled(boolean enabled)
If this field is set to false the user is disabled, meaning they cannot log in. Disabled Users do not count against perseat licensing.

Parameters:
enabled - If this field is set to false the user is disabled, meaning they cannot log in. Disabled Users do not count against perseat licensing.

isEnabled

boolean isEnabled()
Returns true if the user is disabled, meaning they cannot log in. Disabled Users do not count against perseat licensing.

Returns:
Returns false if the user is disabled

Clearspace Project Page

Copyright © 1999-2007 Jive Software.