public class User
extends java.lang.Object
Note: passwords are not stored with the User objects.
Constructor and Description |
---|
User()
No-argument Constructor for the User object
|
User(java.io.File source)
Constructor for the User object
|
Modifier and Type | Method and Description |
---|---|
boolean |
controls(Roles.Role role,
java.lang.String collection)
Does this user have a role higher than the provided for the specified collection
|
void |
deletePref(java.lang.String name)
Delete a rref (if the collection is not the default collection)
|
void |
deleteRole(java.lang.String collection)
Delete a role (if the collection is not the default collection)
|
void |
destroy()
Destroy the datastructures for this User object
|
void |
flush()
Write this User to disk and reset data structures so they will be
reloaded from disk.
|
Roles.Role |
getAssignedRole(java.lang.String collection)
Return the role that has been explicitly assigned to the specified
collection.
|
java.lang.String |
getDepartment()
Gets the department attribute of the User object
|
java.lang.String |
getEmail()
Return the from address.
|
java.lang.String |
getFirstName()
Gets the firstName attribute of the User object
|
java.lang.String |
getFullName()
Gets the fullName attribute of the User object
|
java.lang.String |
getInstitution()
Gets the institution attribute of the User object
|
boolean |
getIsAdminUser()
Returns true of this user is an admin
|
java.lang.String |
getLastName()
Gets the lastName attribute of the User object
|
Roles.Role |
getMaxRole()
Gets the maxRole attribute of the User object
|
java.lang.String |
getPref(java.lang.String prefname)
Gets the pref attribute of the User object
|
java.util.Map |
getPrefMap()
Gets the roleMap attribute of the User object
|
Roles.Role |
getRole(java.lang.String collection)
Gets the effective role for this collection, meaning if there is no
explicit role assigned, use the default.
|
java.util.Map |
getRoleMap()
Gets the roleMap attribute of the User object
|
java.io.File |
getSource()
Gets the file for this user object
|
java.lang.String |
getUsername()
Return the username.
|
boolean |
hasRole(Roles.Role role)
Returns true if this User has a role statisfying provided Role in any
collection.
|
boolean |
hasRole(Roles.Role role,
java.lang.String collection)
Returns true if this User has at least the specified role in the specified collection
|
boolean |
hasRole(java.lang.String roleStr)
NOT YET DOCUMENTED
|
boolean |
hasRole(java.lang.String roleStr,
java.lang.String collection)
Returns true if this User has a role statisfying provided Role in the specified
collection.
|
boolean |
isAdminUser()
Returns true of this user is an admin
|
static void |
main(java.lang.String[] args)
The main program for the User class
|
java.lang.String |
nonNullValue(java.lang.String s)
NOT YET DOCUMENTED
|
protected static void |
prtln(java.lang.String s)
NOT YET DOCUMENTED
|
void |
setAdminUser(boolean isAdmin)
Sets the adminUser attribute of the User object
|
void |
setDepartment(java.lang.String department)
Sets the department attribute of the User object
|
void |
setEmail(java.lang.String email)
Set the from address.
|
void |
setFirstName(java.lang.String firstName)
Sets the firstName attribute of the User object
|
void |
setInstitution(java.lang.String institution)
Sets the institution attribute of the User object
|
void |
setLastName(java.lang.String lastName)
Sets the lastName attribute of the User object
|
void |
setPref(java.lang.String name,
java.lang.String val)
Set the User's rref for specified collection.
|
void |
setRole(java.lang.String collection,
Roles.Role role)
Set the User's role for specified collection.
|
void |
setSource(java.io.File file)
Sets the file path for this object (where it is flushed).
|
void |
setUsername(java.lang.String username)
Set the username.
|
java.lang.String |
toString()
NOT YET DOCUMENTED
|
public User(java.io.File source) throws java.lang.Exception
source
- User data filejava.lang.Exception
- if the user cannot be instantiatedpublic User() throws java.lang.Exception
java.lang.Exception
- Description of the Exceptionpublic java.io.File getSource()
public void setSource(java.io.File file)
file
- The new source valuepublic java.lang.String getUsername()
public void setUsername(java.lang.String username)
username
- The new usernamepublic java.lang.String getEmail()
public void setEmail(java.lang.String email)
email
- The new from addresspublic java.lang.String getFirstName()
public void setFirstName(java.lang.String firstName)
firstName
- The new firstName valuepublic java.lang.String getLastName()
public void setLastName(java.lang.String lastName)
lastName
- The new lastName valuepublic java.lang.String getFullName()
public java.lang.String getInstitution()
public void setInstitution(java.lang.String institution)
institution
- The new institution valuepublic java.lang.String getDepartment()
public void setDepartment(java.lang.String department)
department
- The new department valuepublic java.util.Map getPrefMap()
public java.lang.String getPref(java.lang.String prefname)
prefname
- Description of the Parameterpublic void setPref(java.lang.String name, java.lang.String val)
If the rref to set is the same as the User's default rref, then delete the rref for the specified collection (effectively setting it, since calls to getPref for that collection will return the default rref).
name
- The new pref valueval
- The new pref valuepublic void deletePref(java.lang.String name)
name
- Description of the Parameterpublic Roles.Role getMaxRole()
public Roles.Role getAssignedRole(java.lang.String collection)
collection
- NOT YET DOCUMENTEDpublic Roles.Role getRole(java.lang.String collection)
collection
- the collectionpublic boolean hasRole(java.lang.String roleStr)
roleStr
- NOT YET DOCUMENTEDpublic boolean hasRole(java.lang.String roleStr, java.lang.String collection)
roleStr
- specified role (as string)collection
- the collectionpublic boolean hasRole(Roles.Role role)
role
- specified rolepublic boolean hasRole(Roles.Role role, java.lang.String collection)
role
- the rolecollection
- the collectionpublic void setAdminUser(boolean isAdmin)
isAdmin
- The new adminUser valuepublic boolean isAdminUser()
public boolean getIsAdminUser()
public boolean controls(Roles.Role role, java.lang.String collection)
role
- NOT YET DOCUMENTEDcollection
- NOT YET DOCUMENTEDpublic void setRole(java.lang.String collection, Roles.Role role)
If the role to set is the same as the User's default role, then delete the role for the specified collection (effectively setting it, since calls to getRole for that collection will return the default role).
collection
- The new role valuerole
- The new role valuepublic void deleteRole(java.lang.String collection)
collection
- NOT YET DOCUMENTEDpublic java.util.Map getRoleMap()
public java.lang.String nonNullValue(java.lang.String s)
s
- NOT YET DOCUMENTEDpublic java.lang.String toString()
toString
in class java.lang.Object
public void flush() throws java.lang.Exception
java.lang.Exception
- Description of the Exceptionpublic void destroy()
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- The command line argumentsjava.lang.Exception
- Description of the Exceptionprotected static void prtln(java.lang.String s)
s
- NOT YET DOCUMENTED