com.filenet.wcm.apps.server.util
Class AccessRoles

java.lang.Object
  extended bycom.filenet.wcm.apps.server.util.AccessRoles

public class AccessRoles
extends java.lang.Object

This class manages Access Roles.


Nested Class Summary
static class AccessRoles.DefinedRole
          These objects are contained in a List returned by getDefinedRoles method
 class AccessRoles.Role
          Represents Access Role object
 
Field Summary
static java.lang.String ROLE_TYPE_AE_ADMINS
           
static java.lang.String ROLE_TYPE_PS_CONSOLE
           
static java.lang.String ROLE_TYPE_PS_DESIGNER
           
static java.lang.String ROLE_TYPE_PW_ADMINISTRATOR
           
static java.lang.String ROLE_TYPE_PW_CONFIGURATION
           
static java.lang.String ROLE_TYPE_PW_DESIGNER
           
 
Method Summary
 boolean checkRoleAccess(java.util.Collection roles)
          Checks if the current user belogs to any of the roles passed in the roles Collection.
 boolean checkRoleAccess(java.lang.String roleId)
          Checks if the current user belongs to the passed role
 boolean checkRoleAccess(java.lang.String[] roles)
          Checks if the current user belogs to any of the roles passed in the roles array.
 AccessRoles.Role createRole(java.lang.String roleName)
          Creates a new role
 AccessRoles.Role createTemporaryRole(java.lang.String roleName, java.lang.String roleType, java.lang.String description)
          Creates a temporary new role
 void deleteAllRoles()
          Deletes all roles.
 void deleteRole(java.lang.String roleId)
          Deletes a role
 AccessRoles.Role getAdminRole()
          Returns AccessRoles.Role object that represents the administrators role
 java.util.List getDefinedRoles()
          This method will return a list of all roles defined in the system, even if the current user does not have access to some or all of them.
static AccessRoles getEmptyInstance(com.filenet.wcm.toolkit.server.util.WcmDataStore ds)
          Returns an instance of AccessRoles object with the administrator role.
static AccessRoles getInstance(com.filenet.wcm.toolkit.server.util.WcmDataStore ds)
          Factory method to obtain the instance of AccessRole object
 AccessRoles.Role getRole(java.lang.String roleId)
          Finds role based on role id
 java.util.List getRoleList()
          Return the list of AccessRoles.Role object that the current user can see
 java.util.Map getRoleMap()
          Return map of role ids to role names.
 java.lang.String getRoleName(java.lang.String roleId)
          Retrieves role name for a role id.
 AccessRoles.Role getSystemRole(java.lang.String systemRoleType)
          Finds a system role based on role type.
 java.util.Set getSystemRoleSet()
          Return a set of role types.
 java.util.Set getUserRoles()
          Returns a set of role ids that the current user can see
static AccessRoles initializeRoles(com.filenet.wcm.toolkit.server.util.WcmDataStore ds, AccessRoles.Role adminRoleTemplate)
          Creates a set of system roles.
 void loadPermissions()
          Loads members collection for each role.
 void saveRoles()
          Saves all roles.
static java.util.List sortRoleList(java.util.List roles)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROLE_TYPE_AE_ADMINS

public static final java.lang.String ROLE_TYPE_AE_ADMINS
See Also:
Constant Field Values

ROLE_TYPE_PW_ADMINISTRATOR

public static final java.lang.String ROLE_TYPE_PW_ADMINISTRATOR
See Also:
Constant Field Values

ROLE_TYPE_PW_CONFIGURATION

public static final java.lang.String ROLE_TYPE_PW_CONFIGURATION
See Also:
Constant Field Values

ROLE_TYPE_PW_DESIGNER

public static final java.lang.String ROLE_TYPE_PW_DESIGNER
See Also:
Constant Field Values

ROLE_TYPE_PS_CONSOLE

public static final java.lang.String ROLE_TYPE_PS_CONSOLE
See Also:
Constant Field Values

ROLE_TYPE_PS_DESIGNER

public static final java.lang.String ROLE_TYPE_PS_DESIGNER
See Also:
Constant Field Values
Method Detail

getRoleName

public java.lang.String getRoleName(java.lang.String roleId)
Retrieves role name for a role id. This is used in any place in the UI which displays a list of roles, outside of PrefAccessRolesInfoPage.

Parameters:
roleId -

getRole

public AccessRoles.Role getRole(java.lang.String roleId)
Finds role based on role id

Parameters:
roleId -

getSystemRole

public AccessRoles.Role getSystemRole(java.lang.String systemRoleType)
Finds a system role based on role type. If the current user cannot see the system role, this method will return null

Parameters:
systemRoleType -

getRoleList

public java.util.List getRoleList()
Return the list of AccessRoles.Role object that the current user can see


getRoleMap

public java.util.Map getRoleMap()
Return map of role ids to role names. (This method might be removed later).


getSystemRoleSet

public java.util.Set getSystemRoleSet()
Return a set of role types.


getAdminRole

public AccessRoles.Role getAdminRole()
Returns AccessRoles.Role object that represents the administrators role


getInstance

public static AccessRoles getInstance(com.filenet.wcm.toolkit.server.util.WcmDataStore ds)
                               throws java.lang.Exception
Factory method to obtain the instance of AccessRole object

Throws:
java.lang.Exception

initializeRoles

public static AccessRoles initializeRoles(com.filenet.wcm.toolkit.server.util.WcmDataStore ds,
                                          AccessRoles.Role adminRoleTemplate)
                                   throws java.lang.Exception
Creates a set of system roles. Do not call - this is used only in bootstrap page

Parameters:
ds -
adminRoleTemplate -
Returns:
Throws:
java.lang.Exception

getEmptyInstance

public static AccessRoles getEmptyInstance(com.filenet.wcm.toolkit.server.util.WcmDataStore ds)
                                    throws java.lang.Exception
Returns an instance of AccessRoles object with the administrator role. The admin role contained by this object does not exist phisically. This method is used only by the bootstrap page. Do not use this method.

Parameters:
ds -
Returns:
Throws:
java.lang.Exception

getUserRoles

public java.util.Set getUserRoles()
Returns a set of role ids that the current user can see


saveRoles

public void saveRoles()
               throws java.lang.Exception
Saves all roles. Called by PrefAccessRolesInfoPage in panelFinish()

Throws:
java.lang.Exception

loadPermissions

public void loadPermissions()
                     throws java.lang.Exception
Loads members collection for each role. This is done in a batch, which is more efficient then doing it individually for each role

Throws:
java.lang.Exception

deleteAllRoles

public void deleteAllRoles()
Deletes all roles. Use cautiously.


deleteRole

public void deleteRole(java.lang.String roleId)
Deletes a role

Parameters:
roleId -

createRole

public AccessRoles.Role createRole(java.lang.String roleName)
                            throws java.lang.Exception
Creates a new role

Parameters:
roleName -
Returns:
Throws:
java.lang.Exception

createTemporaryRole

public AccessRoles.Role createTemporaryRole(java.lang.String roleName,
                                            java.lang.String roleType,
                                            java.lang.String description)
Creates a temporary new role

Parameters:
roleName -
roleType - indicates this role is a system role
Returns:
Role object

checkRoleAccess

public boolean checkRoleAccess(java.util.Collection roles)
Checks if the current user belogs to any of the roles passed in the roles Collection. Returns true if roles parameter is null or empty

Parameters:
roles -
Returns:
true or false

checkRoleAccess

public boolean checkRoleAccess(java.lang.String[] roles)
Checks if the current user belogs to any of the roles passed in the roles array. Returns true if roles parameter is null or empty

Parameters:
roles -
Returns:
true or false

checkRoleAccess

public boolean checkRoleAccess(java.lang.String roleId)
Checks if the current user belongs to the passed role

Parameters:
roleId - GUID for a normal role or a role type for a system role
Returns:
true or false

getDefinedRoles

public java.util.List getDefinedRoles()
This method will return a list of all roles defined in the system, even if the current user does not have access to some or all of them.

Returns:
List of DefinedRole objects

sortRoleList

public static java.util.List sortRoleList(java.util.List roles)


© Copyright IBM Corp. 2002, 2007. All Rights Reserved.