za.org.coefficient.util.ejb
Class SecurityUtil
java.lang.Object
za.org.coefficient.util.ejb.SecurityUtil
- All Implemented Interfaces:
- java.io.Serializable
public class SecurityUtil
- extends java.lang.Object
- implements java.io.Serializable
This is a utility class that allows access to users and roles in
the system
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SITE_ADMIN_ROLE_DESC
public static final java.lang.String SITE_ADMIN_ROLE_DESC
- See Also:
- Constant Field Values
SITE_MODERATOR_ROLE_DESC
public static final java.lang.String SITE_MODERATOR_ROLE_DESC
- See Also:
- Constant Field Values
PROJECT_CHAMPION_ROLE_DESC
public static final java.lang.String PROJECT_CHAMPION_ROLE_DESC
- See Also:
- Constant Field Values
PROJECT_MEMBER_ROLE_DESC
public static final java.lang.String PROJECT_MEMBER_ROLE_DESC
- See Also:
- Constant Field Values
SITE_MEMBER_ROLE_DESC
public static final java.lang.String SITE_MEMBER_ROLE_DESC
- See Also:
- Constant Field Values
GUEST_ROLE_DESC
public static final java.lang.String GUEST_ROLE_DESC
- See Also:
- Constant Field Values
SITE_ADMIN_ROLE_VAL
public static final long SITE_ADMIN_ROLE_VAL
- See Also:
- Constant Field Values
SITE_MODERATOR_ROLE_VAL
public static final long SITE_MODERATOR_ROLE_VAL
- See Also:
- Constant Field Values
PROJECT_CHAMPION_ROLE_VAL
public static final long PROJECT_CHAMPION_ROLE_VAL
- See Also:
- Constant Field Values
PROJECT_MEMBER_ROLE_VAL
public static final long PROJECT_MEMBER_ROLE_VAL
- See Also:
- Constant Field Values
SITE_MEMBER_ROLE_VAL
public static final long SITE_MEMBER_ROLE_VAL
- See Also:
- Constant Field Values
GUEST_ROLE_VAL
public static final long GUEST_ROLE_VAL
- See Also:
- Constant Field Values
HEX_ALPHABET
private static final java.lang.String[] HEX_ALPHABET
roleDescCache
private static java.util.HashMap roleDescCache
roleValCache
private static java.util.TreeMap roleValCache
SecurityUtil
public SecurityUtil()
getAllUsers
public static java.util.List getAllUsers()
getHighestRoleForUser
public static Role getHighestRoleForUser(CoefficientUser user,
Project project)
- This is used to determine the correct role in the role hierarchy for
a user. The hierarchy is from highest to lowest:
1. SecurityUtil.SITE_ADMIN_ROLE_DESC - a system/project role
2. SecurityUtil.PROJECT_CHAMPION_ROLE_DESC - a project role
3. SecurityUtil.PROJECT_MEMBER_ROLE_DESC - a project role
4. SecurityUtil.SITE_MEMBER_ROLE_DESC - a system role
5. SecurityUtil.GUEST_ROLE_DESC - a system/project role
- Parameters:
user
- is the user to determine the role for, if null then this
method will return the guest roleproject
- is the project obtained from a context. If null then
the role returned will be obtained
from the system role contained in the user
- Returns:
- is the highest role associated with the current user given
the project information
getRoleForDescription
public static Role getRoleForDescription(java.lang.String roleDescription)
getRoleForValue
public static Role getRoleForValue(long roleValue)
getRoles
public static java.util.List getRoles()
getUsersWithSystemRole
public static java.util.List getUsersWithSystemRole(Role role)
md5
public static byte[] md5(java.lang.String text)
- Computes an md5 hash of a string.
- Parameters:
text
- the hashed string
- Returns:
- the string hash
- Throws:
java.lang.NullPointerException
- if text is null
md5AsHexString
public static java.lang.String md5AsHexString(java.lang.String text)
- Computes an md5 hash and returns the result as a string
made of hexadecimal HEX_ALPHABET whose.
- Parameters:
text
- the hashed string
- Returns:
- the string hash
- Throws:
java.lang.NullPointerException
- if text is null
Copyright CSIR. All Rights Reserved.