|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectblackboard.platform.security.SecurityUtil
public class SecurityUtil
This class provides utility methods for security logic, notably around checking for entitlements. There are additional methods for converting strings to hashes.
| Field Summary | |
|---|---|
static java.lang.String |
HASH_ALGORITHM
|
| Constructor Summary | |
|---|---|
SecurityUtil()
|
|
| Method Summary | |
|---|---|
static void |
checkEntitlement(java.lang.String uid)
Checks if the current user in context has the specified entitlement. |
static void |
checkEntitlementInContext(java.lang.String uid,
Id context)
Checks if the current user in the specified context has the specified entitlement. |
static void |
checkPermission(java.security.Permission perm)
Performs a check for the specified permission against the installed SecurityManager. |
static BbResourceBundle |
getBundle()
Returns the security ResourceBundle, based on the current context locale. |
static java.lang.String |
getHashValue(java.lang.String input)
Utility method that generates a hex-formatted string representation of the message digest obtained from the specified string. |
static java.lang.String |
getHashValue(java.lang.String input,
java.lang.String charSet)
Utility method that generates a hex-formatted string representation of the message digest obtained from the specified string. |
static void |
requireEntitledUser(java.lang.String uid,
javax.servlet.http.HttpServletRequest request)
Throws a BbSecurityException, which will be caught by the Error receipt infrastructure and require the user to log in as a different user. |
static boolean |
userHasAllEntitlements(java.lang.String[] entitlementNames)
Checks to see if the user has all the entitlements specified, using Context derived from specified HttpServletRequest object. |
static boolean |
userHasAnyEntitlements(java.lang.String[] entitlementNames)
Wrapper method for AccessManagerService.userHasAnyEntitlements( String[] ). |
static boolean |
userHasEntitlement(Entitlement entitlement)
Checks if the current context user has the specified entitlement. |
static boolean |
userHasEntitlement(Entitlement entitlement,
Identifiable obj)
Method to check an entitlement for a specific object, which is assumed to be related to the user via a Domain Admin association. |
static boolean |
userHasEntitlement(java.lang.String entitlementUID)
Checks if the current context user has the entitlement with the specified UID. |
static boolean |
userHasEntitlement(User user,
CourseMembership courseMembership,
Entitlement entitlement)
Explicit check for a single entitlement. |
static boolean |
userHasEntitlementInContext(Entitlement entitlement,
Id targetContextId)
Wrapper method for AccessManagerService.userHasEntitlementInContext( Entitlement, Id ). |
static boolean |
userHasEntitlementInContext(java.lang.String entitlementUid,
Id targetContextId)
Wrapper method for AccessManagerService.userHasEntitlementInContext( String, Id ). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String HASH_ALGORITHM
| Constructor Detail |
|---|
public SecurityUtil()
| Method Detail |
|---|
public static void checkPermission(java.security.Permission perm)
SecurityManager.
If no SecurityManager is installed, this is a no-op.
perm - The permission to check. For convenience, this may be null. The result is a no-op.public static java.lang.String getHashValue(java.lang.String input)
input - String to hash, format and return
public static java.lang.String getHashValue(java.lang.String input,
java.lang.String charSet)
input - String to hash, format and returncharSet - set to be used ( UTF-8 or ISO-8859-1 )
public static void checkEntitlement(java.lang.String uid)
throws AccessException
AccessException will be thrown.
uid - The uid of the entitlement to check. If this does not specify
a valid entitlement, AccessException will always be thrown
AccessException - if the current user in context does not have the
specified entitlementuserHasEntitlement(String)
public static void checkEntitlementInContext(java.lang.String uid,
Id context)
throws AccessException
AccessException will be thrown.
uid - The uid of the entitlement to check. If this does not specify
a valid entitlement, AccessException will always be throwncontext - The context to check the entitlement against
AccessException - if the current user in context does not have the
specified entitlementuserHasEntitlementInContext(String, Id)
public static void requireEntitledUser(java.lang.String uid,
javax.servlet.http.HttpServletRequest request)
throws BbSecurityException
uid - request -
BbSecurityExceptionpublic static boolean userHasEntitlement(java.lang.String entitlementUID)
entitlementUID - UID of the entitlement to check. If this does not
specify a valid entitlement UID, the check will
always return false.
public static boolean userHasEntitlement(Entitlement entitlement)
entitlement - the entitlement to check. If null, the
check will always return false.
null
public static boolean userHasEntitlement(User user,
CourseMembership courseMembership,
Entitlement entitlement)
user - the current User, usually stored in the Context for this threadcourseMembership - Used to determine any entitlements conferrable from a
course role. This argument may be null.entitlement - the Entitlement to check. If this is null, false is
returned.
public static boolean userHasEntitlement(Entitlement entitlement,
Identifiable obj)
entitlement - Entitlement to checkobj - IBbObject instance; must of type Course, User, Organization, Module or Tab
to be effective. If the object is a course, an enrollment check is also performed
public static boolean userHasAllEntitlements(java.lang.String[] entitlementNames)
entitlementNames - Array of entitlement UIDs to check
public static boolean userHasAnyEntitlements(java.lang.String[] entitlementNames)
AccessManagerService.userHasAnyEntitlements( String[] ).
entitlementNames - List of entitlements to check
public static boolean userHasEntitlementInContext(java.lang.String entitlementUid,
Id targetContextId)
AccessManagerService.userHasEntitlementInContext( String, Id ).
entitlementUid - Entitlement id to checktargetContextId - Id object for the target context
public static boolean userHasEntitlementInContext(Entitlement entitlement,
Id targetContextId)
AccessManagerService.userHasEntitlementInContext( Entitlement, Id ).
entitlement - Entitlement to checktargetContextId - Id object for the target context
public static BbResourceBundle getBundle()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||