|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectccc.domain.Entity
ccc.domain.Principal
ccc.domain.UserEntity
public class UserEntity
A user of the CCC system. FIXME: email should never be NULL.
Field Summary | |
---|---|
static UserEntity |
SYSTEM_USER
SYSTEM_USER : User. |
Constructor Summary | |
---|---|
protected |
UserEntity()
Constructor. |
|
UserEntity(Username username,
java.lang.String passwordString)
Constructor. |
|
UserEntity(Username username,
java.lang.String name,
java.lang.String passwordString)
Constructor. |
Method Summary | |
---|---|
void |
addGroup(GroupEntity group)
Adds a user to a group. |
void |
addMetadata(java.util.Map<java.lang.String,java.lang.String> metadata)
Add metadata to this resource. |
void |
addMetadatum(java.lang.String key,
java.lang.String value)
Add new metadata for this resource. |
void |
clearGroups()
Mutator - clear all groups for this user. |
void |
clearMetadata()
Remove all metadata for this resource. |
void |
clearMetadatum(java.lang.String key)
Remove the metadatum with the specified key. |
EmailAddress |
getEmail()
Accessor for the email property. |
java.util.Set<java.util.UUID> |
getGroupIds()
Query - return the IDs for all groups this user is a member of. |
java.util.Set<GroupEntity> |
getGroups()
Accessor for user groups. |
java.util.Map<java.lang.String,java.lang.String> |
getMetadata()
Accessor for all metadata. |
java.lang.String |
getMetadatum(java.lang.String key)
Retrieve metadata for this resource. |
byte[] |
getPassword()
Accessor. |
java.util.Collection<java.lang.String> |
getPermissions()
Query - determines all permissions available to this user. |
Username |
getUsername()
Accessor for the username property. |
boolean |
hasPassword(java.lang.String passwordString)
Compares hash of the passwordString to the field hash. |
boolean |
hasPermission(java.lang.String permission)
Helper method to check if the user has the specified permission. |
boolean |
includes(UserEntity user)
Check if the specified user is included by this principal. |
static java.util.List<User> |
map(java.util.Collection<UserEntity> users)
Create summaries for a list of users. |
static boolean |
matches(byte[] expected,
java.lang.String password,
java.lang.String salt)
Test whether a hash matches the specified password. |
void |
setEmail(EmailAddress email)
Mutator for the user's email. |
void |
setPassword(java.lang.String passwordString)
Mutator for the password. |
void |
setUsername(Username username)
Mutator for the username. |
User |
toDto()
Convert a user to a DTO. |
void |
toJson(Json json)
Convert to JSON. |
Methods inherited from class ccc.domain.Principal |
---|
getName, setName |
Methods inherited from class ccc.domain.Entity |
---|
equals, getId, getVersion, hashCode, setId, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final UserEntity SYSTEM_USER
Constructor Detail |
---|
protected UserEntity()
public UserEntity(Username username, java.lang.String name, java.lang.String passwordString)
username
- The user's unique name within CCC.name
- The user's full name.passwordString
- The unhashed password as a string.public UserEntity(Username username, java.lang.String passwordString)
username
- The user's unique name within CCC.passwordString
- The unhashed password as a string.Method Detail |
---|
public Username getUsername()
public void setUsername(Username username)
username
- The username.public void setEmail(EmailAddress email)
email
- The email.public EmailAddress getEmail()
public void addGroup(GroupEntity group)
group
- The group to assign.public boolean hasPermission(java.lang.String permission)
permission
- The permission to be checked.
public java.util.Set<GroupEntity> getGroups()
public void addMetadatum(java.lang.String key, java.lang.String value)
key
- The key by which the datum will be accessed.value
- The value of the datum. May not be NULL.public java.lang.String getMetadatum(java.lang.String key)
key
- The key with which the datum was stored.
public void clearMetadatum(java.lang.String key)
key
- The key with which the datum was stored.public java.util.Map<java.lang.String,java.lang.String> getMetadata()
public void clearMetadata()
public void addMetadata(java.util.Map<java.lang.String,java.lang.String> metadata)
metadata
- The metadata to add, as a hashmap.public void setPassword(java.lang.String passwordString)
passwordString
- The new password.public boolean hasPassword(java.lang.String passwordString)
passwordString
- The unhashed password as a string.
public static boolean matches(byte[] expected, java.lang.String password, java.lang.String salt)
expected
- The expected hash.password
- The password to test.salt
- The salt to use.
public void toJson(Json json)
toJson
in interface Jsonable
toJson
in class Entity
json
- The JSON object to write to.public java.util.Set<java.util.UUID> getGroupIds()
public void clearGroups()
public User toDto()
public java.util.Collection<java.lang.String> getPermissions()
public static java.util.List<User> map(java.util.Collection<UserEntity> users)
users
- The users.
public boolean includes(UserEntity user)
includes
in class Principal
user
- The user to check.
public byte[] getPassword()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |