DLESE Tools
v1.6.0

org.dlese.dpc.schemedit.security.user
Class User

java.lang.Object
  extended by org.dlese.dpc.schemedit.security.user.User

public class User
extends Object

Class that represents a registered DCS User, including attributes, roles and preferences.

Note: passwords are not stored with the User objects.

Author:
ostwald

Constructor Summary
User()
          No-argument Constructor for the User object
User(File source)
          Constructor for the User object
 
Method Summary
 boolean controls(Roles.Role role, String collection)
          Does this user have a role higher than the provided for the specified collection
 void deletePref(String name)
          Delete a rref (if the collection is not the default collection)
 void deleteRole(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(String collection)
          Return the role that has been explicitly assigned to the specified collection.
 String getDepartment()
          Gets the department attribute of the User object
 String getEmail()
          Return the from address.
 String getFirstName()
          Gets the firstName attribute of the User object
 String getFullName()
          Gets the fullName attribute of the User object
 String getInstitution()
          Gets the institution attribute of the User object
 boolean getIsAdminUser()
          Returns true of this user is an admin
 String getLastName()
          Gets the lastName attribute of the User object
 Roles.Role getMaxRole()
          Gets the maxRole attribute of the User object
 String getPref(String prefname)
          Gets the pref attribute of the User object
 Map getPrefMap()
          Gets the roleMap attribute of the User object
 Roles.Role getRole(String collection)
          Gets the effective role for this collection, meaning if there is no explicit role assigned, use the default.
 Map getRoleMap()
          Gets the roleMap attribute of the User object
 File getSource()
          Gets the file for this user object
 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, String collection)
          Returns true if this User has at least the specified role in the specified collection
 boolean hasRole(String roleStr)
          NOT YET DOCUMENTED
 boolean hasRole(String roleStr, 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(String[] args)
          The main program for the User class
 String nonNullValue(String s)
          NOT YET DOCUMENTED
protected static void prtln(String s)
          NOT YET DOCUMENTED
 void setAdminUser(boolean isAdmin)
          Sets the adminUser attribute of the User object
 void setDepartment(String department)
          Sets the department attribute of the User object
 void setEmail(String email)
          Set the from address.
 void setFirstName(String firstName)
          Sets the firstName attribute of the User object
 void setInstitution(String institution)
          Sets the institution attribute of the User object
 void setLastName(String lastName)
          Sets the lastName attribute of the User object
 void setPref(String name, String val)
          Set the User's rref for specified collection.
 void setRole(String collection, Roles.Role role)
          Set the User's role for specified collection.
 void setSource(File file)
          Sets the file path for this object (where it is flushed).
 void setUsername(String username)
          Set the username.
 String toString()
          NOT YET DOCUMENTED
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

User

public User(File source)
     throws Exception
Constructor for the User object

Parameters:
source - User data file
Throws:
Exception - if the user cannot be instantiated

User

public User()
     throws Exception
No-argument Constructor for the User object

Throws:
Exception - Description of the Exception
Method Detail

getSource

public File getSource()
Gets the file for this user object

Returns:
The source value

setSource

public void setSource(File file)
Sets the file path for this object (where it is flushed).

Parameters:
file - The new source value

getUsername

public String getUsername()
Return the username.

Returns:
The username value

setUsername

public void setUsername(String username)
Set the username.

Parameters:
username - The new username

getEmail

public String getEmail()
Return the from address.

Returns:
The email value

setEmail

public void setEmail(String email)
Set the from address.

Parameters:
email - The new from address

getFirstName

public String getFirstName()
Gets the firstName attribute of the User object

Returns:
The firstName value

setFirstName

public void setFirstName(String firstName)
Sets the firstName attribute of the User object

Parameters:
firstName - The new firstName value

getLastName

public String getLastName()
Gets the lastName attribute of the User object

Returns:
The lastName value

setLastName

public void setLastName(String lastName)
Sets the lastName attribute of the User object

Parameters:
lastName - The new lastName value

getFullName

public String getFullName()
Gets the fullName attribute of the User object

Returns:
The fullName value

getInstitution

public String getInstitution()
Gets the institution attribute of the User object

Returns:
The institution value

setInstitution

public void setInstitution(String institution)
Sets the institution attribute of the User object

Parameters:
institution - The new institution value

getDepartment

public String getDepartment()
Gets the department attribute of the User object

Returns:
The department value

setDepartment

public void setDepartment(String department)
Sets the department attribute of the User object

Parameters:
department - The new department value

getPrefMap

public Map getPrefMap()
Gets the roleMap attribute of the User object

Returns:
The prefMap value

getPref

public String getPref(String prefname)
Gets the pref attribute of the User object

Parameters:
prefname - Description of the Parameter
Returns:
The pref value

setPref

public void setPref(String name,
                    String val)
Set the User's rref for specified collection.

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).

Parameters:
name - The new pref value
val - The new pref value

deletePref

public void deletePref(String name)
Delete a rref (if the collection is not the default collection)

Parameters:
name - Description of the Parameter

getMaxRole

public Roles.Role getMaxRole()
Gets the maxRole attribute of the User object

Returns:
The maxRole value

getAssignedRole

public Roles.Role getAssignedRole(String collection)
Return the role that has been explicitly assigned to the specified collection. Returns null if there is no assignment.

Parameters:
collection - NOT YET DOCUMENTED
Returns:
The assignedRole value

getRole

public Roles.Role getRole(String collection)
Gets the effective role for this collection, meaning if there is no explicit role assigned, use the default.

Parameters:
collection - the collection
Returns:
The role value

hasRole

public boolean hasRole(String roleStr)
NOT YET DOCUMENTED

Parameters:
roleStr - NOT YET DOCUMENTED
Returns:
NOT YET DOCUMENTED

hasRole

public boolean hasRole(String roleStr,
                       String collection)
Returns true if this User has a role statisfying provided Role in the specified collection.

Parameters:
roleStr - specified role (as string)
collection - the collection
Returns:
true if the user has permission for this collection

hasRole

public boolean hasRole(Roles.Role role)
Returns true if this User has a role statisfying provided Role in any collection.

Parameters:
role - specified role
Returns:
true if this User has a role statisfying provided Role in any collection

hasRole

public boolean hasRole(Roles.Role role,
                       String collection)
Returns true if this User has at least the specified role in the specified collection

Parameters:
role - the role
collection - the collection
Returns:
NOT YET DOCUMENTED

setAdminUser

public void setAdminUser(boolean isAdmin)
Sets the adminUser attribute of the User object

Parameters:
isAdmin - The new adminUser value

isAdminUser

public boolean isAdminUser()
Returns true of this user is an admin

Returns:
The adminUser value

getIsAdminUser

public boolean getIsAdminUser()
Returns true of this user is an admin

Returns:
The isAdminUser value

controls

public boolean controls(Roles.Role role,
                        String collection)
Does this user have a role higher than the provided for the specified collection

Parameters:
role - NOT YET DOCUMENTED
collection - NOT YET DOCUMENTED
Returns:
NOT YET DOCUMENTED

setRole

public void setRole(String collection,
                    Roles.Role role)
Set the User's role for specified collection.

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).

Parameters:
collection - The new role value
role - The new role value

deleteRole

public void deleteRole(String collection)
Delete a role (if the collection is not the default collection)

Parameters:
collection - NOT YET DOCUMENTED

getRoleMap

public Map getRoleMap()
Gets the roleMap attribute of the User object

Returns:
The roleMap value

nonNullValue

public String nonNullValue(String s)
NOT YET DOCUMENTED

Parameters:
s - NOT YET DOCUMENTED
Returns:
NOT YET DOCUMENTED

toString

public String toString()
NOT YET DOCUMENTED

Overrides:
toString in class Object
Returns:
NOT YET DOCUMENTED

flush

public void flush()
           throws Exception
Write this User to disk and reset data structures so they will be reloaded from disk.

Throws:
Exception - Description of the Exception

destroy

public void destroy()
Destroy the datastructures for this User object


main

public static void main(String[] args)
                 throws Exception
The main program for the User class

Parameters:
args - The command line arguments
Throws:
Exception - Description of the Exception

prtln

protected static void prtln(String s)
NOT YET DOCUMENTED

Parameters:
s - NOT YET DOCUMENTED

DLESE Tools
v1.6.0