kotkabeans
Class UseModule

java.lang.Object
  |
  +--kotkabeans.UseModule

public class UseModule
extends java.lang.Object

is a class which is used to encapsulate permisson checkings. This class provides information if the user has permission to enter the specific site.


Field Summary
static int ACCESS_RIGHT_LEVEL_ADMINISTRATOR
           
static int ACCESS_RIGHT_LEVEL_CHIEF
           
static int ACCESS_RIGHT_LEVEL_FINANCIAL_SECRETARY
           
static int ACCESS_RIGHT_LEVEL_GUEST
           
static int ACCESS_RIGHT_LEVEL_SECRETARY
           
static int ACCESS_RIGHT_LEVEL_STUDENT
           
static int ACCESS_RIGHT_LEVEL_TEACHER
           
 
Constructor Summary
UseModule()
           
 
Method Summary
static RS2 allCourseRights(int personID)
           
static boolean allowedUser(int personID, int moduleID)
          This method decides whether or not the user has permission to use spesific module.
static boolean canModifyUserGroup(int courseRightLevelOnCourse, int userGroupID)
          This method checks if user can add a person with a given usergroupid to the course.
static int courseRight(int personID, int courseinstanceID)
          This method checks persons biggest usergrouplevel in course.
static int maxCourseRight(int pid)
           
static int maxCourseRight(int pid, int specialstatus)
           
static int maxCourseRight(int pid, java.lang.String specialstatus)
           
static int maxExamRight(int pid)
           
static void promote(java.lang.String account, int level)
           
static int rightLevel(int personID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACCESS_RIGHT_LEVEL_GUEST

public static int ACCESS_RIGHT_LEVEL_GUEST

ACCESS_RIGHT_LEVEL_STUDENT

public static int ACCESS_RIGHT_LEVEL_STUDENT

ACCESS_RIGHT_LEVEL_TEACHER

public static int ACCESS_RIGHT_LEVEL_TEACHER

ACCESS_RIGHT_LEVEL_SECRETARY

public static int ACCESS_RIGHT_LEVEL_SECRETARY

ACCESS_RIGHT_LEVEL_FINANCIAL_SECRETARY

public static int ACCESS_RIGHT_LEVEL_FINANCIAL_SECRETARY

ACCESS_RIGHT_LEVEL_CHIEF

public static int ACCESS_RIGHT_LEVEL_CHIEF

ACCESS_RIGHT_LEVEL_ADMINISTRATOR

public static int ACCESS_RIGHT_LEVEL_ADMINISTRATOR
Constructor Detail

UseModule

public UseModule()
Method Detail

allowedUser

public static boolean allowedUser(int personID,
                                  int moduleID)
                           throws java.lang.Exception
This method decides whether or not the user has permission to use spesific module. Because there are no use-case level accessrights implemented in the database, the permissions are hardcoded here.

Parameters:
personID - Person who tries to access module
moduleID - Module which is accessed. Only identifier 1 is used at this time.
Returns:
Returns true if user is allowed to use module, otherwise false
java.lang.Exception

rightLevel

public static int rightLevel(int personID)
                      throws java.lang.Exception
Parameters:
personID - Person whos accessrightlevel we are looking for.
Returns:
Returns Persons accessrightlevel.
java.lang.Exception

courseRight

public static int courseRight(int personID,
                              int courseinstanceID)
                       throws java.lang.Exception
This method checks persons biggest usergrouplevel in course. Needed when we must know if the person is student or lecturer at given course.

Parameters:
personID - Person who is checked.
Returns:
Returns Persons kurkiusergroupid from CourseParticipant
java.lang.Exception

maxCourseRight

public static int maxCourseRight(int pid)
                          throws java.lang.Exception
java.lang.Exception

maxCourseRight

public static int maxCourseRight(int pid,
                                 int specialstatus)
                          throws java.lang.Exception
java.lang.Exception

maxCourseRight

public static int maxCourseRight(int pid,
                                 java.lang.String specialstatus)
                          throws java.lang.Exception
java.lang.Exception

allCourseRights

public static RS2 allCourseRights(int personID)
                           throws java.lang.Exception
java.lang.Exception

promote

public static void promote(java.lang.String account,
                           int level)
                    throws java.lang.Exception
java.lang.Exception

maxExamRight

public static int maxExamRight(int pid)
                        throws java.lang.Exception
java.lang.Exception

canModifyUserGroup

public static boolean canModifyUserGroup(int courseRightLevelOnCourse,
                                         int userGroupID)
This method checks if user can add a person with a given usergroupid to the course. The adding user's usergrouplevel on the course is given as parameter.

Parameters:
courseRightLevelOnCourse - User's usergroup level on course
userGroupID - Check if user can add person with this usergroupid.
Returns:
Returns True if user can add with this usergroupid, otherwise false.