|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object blackboard.platform.security.SecurityUtil
public class SecurityUtil
This class provides utility methods for security logic, notably around checking for entitlements.
Field Summary | |
---|---|
static java.lang.String |
HASH_ALGORITHM
|
Constructor Summary | |
---|---|
SecurityUtil()
|
Method Summary | |
---|---|
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 boolean |
userHasAllEntitlements(Id userId,
Id courseId,
Entitlements entitlements)
userHasAllEntitlements Logical AND Use for fine-grained authorization --User may have be entitled access to a page, but not a given widget on the page |
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 |
userHasAllEntitlements(User user,
Course course,
Entitlements entitlements)
Method to check that a user has all entitlements for an explicit course context. |
static boolean |
userHasAnyEntitlements(java.lang.String[] entitlementNames)
userHasAnyEntitlements Logical OR Use for coarse-grained authorization; for example to check whether user may enter admin page --User may have be entitled access to some but not all widgets on the page --No user id param; implicit Context object assumed |
static boolean |
userHasAnyEntitlements(User user,
CourseMembership courseMembership,
Entitlements entitlements)
userHasAnyEntitlements Logical OR Use for coarse-grained authorization; for example to check whether user may enter admin page --User may have be entitled access to some but not all widgets on the page --User id param; implicit Context object _not_ assumed |
static boolean |
userHasEntitlement(Context context,
Entitlement entitlement)
Checks if the user in the provided context has the specified entitlement. |
static boolean |
userHasEntitlement(Id userId,
Id courseId,
Entitlement entitlement)
Method to check if an explicit user has a specific entitlement. |
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,
Course course,
Entitlement entitlement)
Explicit check for a single entitlement. |
static boolean |
userHasEntitlement(User user,
CourseMembership courseMembership,
Entitlement entitlement)
Explicit check for a single entitlement. |
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 returncharacter
- set to be used ( UTF-8 or ISO-8859-1 )
public 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(Context context, Entitlement entitlement)
context
- the context providing the user to check. If the context
does not have a user, the check will always return false.entitlement
- the entitlement to check. If null
, the
check will always return false.
null
public static boolean userHasEntitlement(Id userId, Id courseId, Entitlement entitlement)
userId
- Explicit id to checkcourseId
- Explicit id to check.entitlement
- Entitlement to check. Cannot be null, or false will automatically be returned
public static boolean userHasEntitlement(User user, Course course, Entitlement entitlement)
user
- the current User, usually stored in the Context for this threadcourse
- the current Course, usually stored in the Context for this
threadentitlement
- the Entitlement in question
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 userHasAllEntitlements(java.lang.String[] entitlementNames)
entitlementNames
- Array of entitlement UIDs to check
public static boolean userHasAllEntitlements(Id userId, Id courseId, Entitlements entitlements)
user
- implicit Context object _not_ assumedcourse
- implicit Context object _not_ assumedpublic static boolean userHasAllEntitlements(User user, Course course, Entitlements entitlements)
user
- the current User, stored in the Context for this threadcourse
- the current Course, stored in the Context for this threadentitlements
- the set of Entitlements in question
public static boolean userHasAnyEntitlements(java.lang.String[] entitlementNames)
public static boolean userHasAnyEntitlements(User user, CourseMembership courseMembership, Entitlements entitlements)
public static BbResourceBundle getBundle()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |