|
Jive Forums API (5.5.20.2-oracle) Developer Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jivesoftware.base.MockUser
public class MockUser
A mock implementation of the User interface - developers should subclass this class to provide more functionality in their test cases.
Constructor Summary | |
---|---|
MockUser(long id)
|
Method Summary | |
---|---|
void |
deleteProperty(java.lang.String name)
Deletes an extended property. |
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 |
getModificationDate()
Returns the date that the user was last modified. |
java.lang.String |
getName()
Returns the user's name. |
java.lang.String |
getPassword()
|
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.lang.String |
getProperty(java.lang.String name)
Returns an extended property of the user. |
java.util.Iterator |
getPropertyNames()
Returns an Iterator for all the names of the extended user properties. |
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 |
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 |
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 |
setProperty(java.lang.String name,
java.lang.String value)
Sets an extended property of the user. |
void |
setUsername(java.lang.String username)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MockUser(long id)
Method Detail |
---|
public long getID()
User
getID
in interface User
public java.lang.String getUsername()
User
getUsername
in interface User
public void setUsername(java.lang.String username)
public java.lang.String getName()
User
getName
in interface User
public void setName(java.lang.String name) throws UnauthorizedException
User
setName
in interface User
name
- new name for the user.
UnauthorizedException
- if does not have administrator permissions.public boolean isNameVisible()
User
isNameVisible
in interface User
public void setNameVisible(boolean visible) throws UnauthorizedException
User
setNameVisible
in interface User
visible
- boolean value to determin if the name should be visible.
UnauthorizedException
- if does not have administrator permissions.public java.lang.String getPassword()
public void setPassword(java.lang.String password) throws UnauthorizedException
User
setPassword
in interface User
password
- new password for the user.
UnauthorizedException
- if does not have administrator permissions.public java.lang.String getPasswordHash() throws UnauthorizedException
User
If your back-end user store does not support this operation, throw an UnsupportedOperationException.
getPasswordHash
in interface User
UnauthorizedException
- if does not have administrator permissions.public void setPasswordHash(java.lang.String passwordHash) throws UnauthorizedException
User
If your back-end user store does not support this operation, throw an UnsupportedOperationException.
setPasswordHash
in interface User
passwordHash
- the hashedPassword for the user.
UnauthorizedException
- if does not have administrator permissions.public java.lang.String getEmail()
User
If your back-end user store does not support this operation, always return null.
getEmail
in interface User
public void setEmail(java.lang.String email) throws UnauthorizedException
User
If your back-end user store does not support this operation, throw an UnsupportedOperationException.
setEmail
in interface User
email
- new email address for the user.
UnauthorizedException
- if does not have administrator permissions.public boolean isEmailVisible()
User
isEmailVisible
in interface User
public void setEmailVisible(boolean visible) throws UnauthorizedException
User
setEmailVisible
in interface User
visible
- boolean value to determin if the name should be visible.
UnauthorizedException
- if does not have administrator permissions.public java.util.Date getCreationDate()
User
If your back-end user store does not support this operation, throw an UnsupportedOperationException.
getCreationDate
in interface User
public void setCreationDate(java.util.Date creationDate) throws UnauthorizedException
User
setCreationDate
in interface User
creationDate
- the date the user was created.
UnauthorizedException
- if does not have administrator permissions.public java.util.Date getModificationDate()
User
getModificationDate
in interface User
public void setModificationDate(java.util.Date modificationDate) throws UnauthorizedException
User
setModificationDate
in interface User
modificationDate
- the date the user was modified.
UnauthorizedException
- if does not have administrator permissions.public java.lang.String getProperty(java.lang.String name)
User
getProperty
in interface User
name
- the name of the property to get.
public void setProperty(java.lang.String name, java.lang.String value) throws UnauthorizedException
User
setProperty
in interface User
name
- the name of the property to set.value
- the new value for the property.
UnauthorizedException
- if not allowed to edit.public void deleteProperty(java.lang.String name) throws UnauthorizedException
User
name
does not exist,
this method will do nothing.
deleteProperty
in interface User
name
- the name of the property to delete.
UnauthorizedException
- if not allowed to edit.public java.util.Iterator getPropertyNames()
User
This method should typically be implemented as:
if (auth.getUserID() == id) {
return new Permissions(Permissions.USER_ADMIN);
}
else {
return new Permissions(Permissions.NONE);
}
getPropertyNames
in interface User
public Permissions getPermissions(AuthToken authToken)
User
getPermissions
in interface User
authToken
- the auth token to look up permissions with.public boolean isAuthorized(long permissionType)
User
Because proxy objects will implement real security checking, this
method should be implemented as:
return true;.
isAuthorized
in interface User
permissionType
- the permission to check for.Permissions
|
Jive Forums Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |