net.sourceforge.jsurveyor
Class AccessControl

java.lang.Object
  extended bynet.sourceforge.jsurveyor.AccessControl

public class AccessControl
extends java.lang.Object

Class that handles privilegies for the User class. If the User, which is assigned an instance of this class, is a questionnaire administrator, AccessControl also keeps track of the UserGroups this User can deploy questionnaires for.

Version:
1.0
Author:
Claus Methmann Christensen, Anders Spliid Hansen, Esben Iversen Hansen, Lars H Jensen, Marcus Overheu, Thomas Ramdal, Peter Thomsen

Constructor Summary
AccessControl(java.lang.String userType)
          Constructor that sets the userType, use this for new objects.
AccessControl(java.lang.String userType, java.util.ArrayList adminUserGroup)
          Constructor that sets all attributes, only for use through DataAccess
 
Method Summary
 void addAdminUserGroup(UserGroup userGroup)
          Adds a userGroup
 java.util.ArrayList getAdminUserGroup()
          Retrieves the ArrayList of added userGroups.
 java.lang.String getUserType()
          Returns the userType
 void removeAdminUserGroup(UserGroup userGroup)
          Removes a usergroup from the list.
 void setUserType(java.lang.String userType)
          Sets the userType.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AccessControl

public AccessControl(java.lang.String userType)
Constructor that sets the userType, use this for new objects.

Parameters:
userType - String
PRE condition:
input must be either "normal", "admin" or "root"

AccessControl

public AccessControl(java.lang.String userType,
                     java.util.ArrayList adminUserGroup)
Constructor that sets all attributes, only for use through DataAccess

Parameters:
userType - String
adminUserGroup - ArrayList
PRE condition:
userType must be either "normal", "admin" or "root", adminUserGroup must contain toString representation of UserGroup objects
Method Detail

setUserType

public void setUserType(java.lang.String userType)
Sets the userType.

Parameters:
userType - String
PRE condition:
input must be either "normal", "admin" or "root"

getUserType

public java.lang.String getUserType()
Returns the userType

Returns:
String
POST condition:
return value is either "normal", "admin" or "root"

addAdminUserGroup

public void addAdminUserGroup(UserGroup userGroup)
Adds a userGroup

Parameters:
userGroup - UserGroup
PRE condition:
userType = "admin", input userGroup must not be in Arraylist adminUserGroup
POST condition:
toString representation of the userGroup has been added

removeAdminUserGroup

public void removeAdminUserGroup(UserGroup userGroup)
Removes a usergroup from the list.

Parameters:
userGroup - UserGroup
PRE condition:
userType = "admin", input userGroup must be added.
POST condition:
userGroup is removed

getAdminUserGroup

public java.util.ArrayList getAdminUserGroup()
Retrieves the ArrayList of added userGroups.

Returns:
ArrayList

toString

public java.lang.String toString()
Returns a string representation of the object.

Returns:
String