de.hs_rm.cs.lecturenotes.server.logical.security
Class PermissionCheckUtil

java.lang.Object
  extended by de.hs_rm.cs.lecturenotes.server.logical.security.PermissionCheckUtil

public final class PermissionCheckUtil
extends java.lang.Object

Common permission check routines. Contains validity and permission checks.

Version:
$LastChangedRevision: 241 $
Author:
Enrico Homann

Method Summary
static void checkForAllowAtLeastAdministratorUser(SQLConnection connect, User currentUser)
          Validity check for a valid AdministratorUser and up.
static void checkForAllowAtLeastDocentUser(SQLConnection connect, User currentUser)
          Validity check for a valid DocentUser and up.
static void checkForAllowAtLeastRegisteredUser(SQLConnection connect, User currentUser)
          Validity check for a valid RegisteredUser and up.
static void checkForAllowAtLeastUnregisteredUser(SQLConnection connect, User currentUser)
          Validity check for a valid UnregisteredUser and up.
static void checkForLectureUpdate(SQLConnection connect, User callerUser, long lectureId)
          Check for a general update of a Lecture object.
static void checkForPublishedLectureGeneral(SQLConnection connect, User callerUser, long lectureId)
          Checks for a published lecture.
static void checkForPublishedLectureParagraphFetch(SQLConnection connect, User callerUser, long lectureId)
          Check if callerUser has permissions to fetch paragraph of a lecture regarding its publishing status.
static void checkForValidDatabaseAccess(SQLConnection connect)
          Validity check for a valid database access with connect or throws the InvalidPermissionException.
static void checkForValidLecture(SQLConnection connect, long lectureId)
          Validity check for a valid lecture or throws the InvalidPermissionException.
static void checkForValidUserLogin(SQLConnection connect, User currentUser)
          Validity check for a valid lecture or throws the InvalidPermissionException.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

checkForValidDatabaseAccess

public static void checkForValidDatabaseAccess(SQLConnection connect)
                                        throws InvalidPermissionException
Validity check for a valid database access with connect or throws the InvalidPermissionException.

Parameters:
connect - SQLConnection
Throws:
InvalidPermissionException - Thrown if there was an problem

checkForValidLecture

public static void checkForValidLecture(SQLConnection connect,
                                        long lectureId)
                                 throws InvalidPermissionException
Validity check for a valid lecture or throws the InvalidPermissionException.

Parameters:
connect - SQLConnection
lectureId - long
Throws:
InvalidPermissionException - Thrown if there was an problem

checkForValidUserLogin

public static void checkForValidUserLogin(SQLConnection connect,
                                          User currentUser)
                                   throws InvalidPermissionException
Validity check for a valid lecture or throws the InvalidPermissionException.

Parameters:
connect - SQLConnection
currentUser - User
Throws:
InvalidPermissionException - Thrown if there was an problem

checkForAllowAtLeastUnregisteredUser

public static void checkForAllowAtLeastUnregisteredUser(SQLConnection connect,
                                                        User currentUser)
                                                 throws InvalidPermissionException
Validity check for a valid UnregisteredUser and up. InvalidPermissionException.

Parameters:
connect - SQLConnection
currentUser - User
Throws:
InvalidPermissionException - Thrown if there was an problem

checkForAllowAtLeastRegisteredUser

public static void checkForAllowAtLeastRegisteredUser(SQLConnection connect,
                                                      User currentUser)
                                               throws InvalidPermissionException
Validity check for a valid RegisteredUser and up. InvalidPermissionException.

Parameters:
connect - SQLConnection
currentUser - User
Throws:
InvalidPermissionException - Thrown if there was an problem

checkForAllowAtLeastDocentUser

public static void checkForAllowAtLeastDocentUser(SQLConnection connect,
                                                  User currentUser)
                                           throws InvalidPermissionException
Validity check for a valid DocentUser and up. InvalidPermissionException.

Parameters:
connect - SQLConnection
currentUser - User
Throws:
InvalidPermissionException - Thrown if there was an problem

checkForAllowAtLeastAdministratorUser

public static void checkForAllowAtLeastAdministratorUser(SQLConnection connect,
                                                         User currentUser)
                                                  throws InvalidPermissionException
Validity check for a valid AdministratorUser and up. InvalidPermissionException.

Parameters:
connect - SQLConnection
currentUser - User
Throws:
InvalidPermissionException - Thrown if there was an problem

checkForLectureUpdate

public static void checkForLectureUpdate(SQLConnection connect,
                                         User callerUser,
                                         long lectureId)
                                  throws InvalidPermissionException
Check for a general update of a Lecture object. This also includes paragraph updates.

Parameters:
connect - SQLConnection
callerUser - User
lectureId - long
Throws:
InvalidPermissionException - Thrown if there was an problem

checkForPublishedLectureParagraphFetch

public static void checkForPublishedLectureParagraphFetch(SQLConnection connect,
                                                          User callerUser,
                                                          long lectureId)
                                                   throws InvalidPermissionException
Check if callerUser has permissions to fetch paragraph of a lecture regarding its publishing status.

Parameters:
connect - SQLConnection
callerUser - User
lectureId - long
Throws:
InvalidPermissionException - Thrown if there was an problem

checkForPublishedLectureGeneral

public static void checkForPublishedLectureGeneral(SQLConnection connect,
                                                   User callerUser,
                                                   long lectureId)
                                            throws InvalidPermissionException
Checks for a published lecture.

Parameters:
connect - SQLConnection
callerUser - User
lectureId - long
Throws:
InvalidPermissionException - Thrown at permission failure