com.wewebu.ow.server.roleimpl.simplerole
Class OwSimpleRoleManager

java.lang.Object
  extended by com.wewebu.ow.server.role.OwStandardRoleManager
      extended by com.wewebu.ow.server.roleimpl.simplerole.OwSimpleRoleManager
All Implemented Interfaces:
OwRoleManager

public class OwSimpleRoleManager
extends OwStandardRoleManager

Simple role manager, which allows everything.

Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.

For licensing information read the license.txt file or
go to: http://wiki.alfresco.com


Nested Class Summary
 
Nested classes/interfaces inherited from class com.wewebu.ow.server.role.OwStandardRoleManager
OwStandardRoleManager.CategoryNames, OwStandardRoleManager.StandardFunctionResources
 
Field Summary
 
Fields inherited from class com.wewebu.ow.server.role.OwStandardRoleManager
APPLICATION_PREFIX_DELIMITER, m_AllowedPluginTypesMap, m_ConfigNode, m_DefaultMimeMap, m_DesignCategoryMap, m_GroupBoxCategoryMap, m_indexFieldsMap, m_MimeMap, m_objectClassesMap, m_PluginCategoryMap, m_PluginMap, m_PluginTypesMap, m_SearchTemplateCategoryMap, m_SelectiveConfigurationMap, m_strDesign, m_VirtualFolderCategoryMap, MS_OFFICE_EMBEDED_DESIGN
 
Fields inherited from interface com.wewebu.ow.server.role.OwRoleManager
m_predefinedcategories, ROLE_ACCESS_MASK_FLAG_DYNAMIC_RESOURCE_MODIFY, ROLE_ACCESS_MASK_FLAG_INDEX_FIELD_MODIFY, ROLE_ACCESS_MASK_FLAG_INDEX_FIELD_VIEW, ROLE_ACCESS_MASK_FLAG_OBJECT_CLASSES_CHECKIN, ROLE_ACCESS_MASK_FLAG_OBJECT_CLASSES_CREATE, ROLE_ACCESS_MASK_FLAG_OBJECT_CLASSES_VIEW, ROLE_ACCESS_RIGHT_ALLOWED, ROLE_ACCESS_RIGHT_DENIED, ROLE_ACCESS_RIGHT_NOT_ALLOWED, ROLE_CATEGORY_DESIGN, ROLE_CATEGORY_INDEX_FIELDS, ROLE_CATEGORY_OBJECT_CLASSES, ROLE_CATEGORY_PLUGIN, ROLE_CATEGORY_SEARCH_TEMPLATE, ROLE_CATEGORY_SELECTIVE_CONFIGURATION, ROLE_CATEGORY_STANDARD_FUNCTION, ROLE_CATEGORY_STARTUP_FOLDER, ROLE_CATEGORY_USER_START, ROLE_CATEGORY_VIRTUAL_FOLDER, ROLE_CATEGORY_VIRTUAL_QUEUE, ROLE_RESOURCE_CONTEXT_CHECKIN, ROLE_RESOURCE_CONTEXT_CREATE, ROLE_RESOURCE_CONTEXT_VIEW, STD_FUNC_CAN_EDIT_SITE_SETTINGS
 
Constructor Summary
OwSimpleRoleManager()
           
 
Method Summary
 boolean canExplicitDeny()
          Check if rolemanager supports explicit deny of resources.
 boolean canPersistAccessMask()
          Check if the rolemanager can persist changes on the access mask.
protected  String dynamicResourceNameFromId(Locale locale_p, String resourceId_p, int category_p)
           
 int getAccessMask(String roleName_p, int category_p, String resourceId_p)
          Get the access mask for this resource.
 int getAccessRights(String roleName_p, int category_p, String resourceId_p)
          Retrieves the access rights for a given role to a given resource.
 Collection getAllowedResources(int category_p)
          get all resources the current user has access to for a given category
protected  Collection<String> getDynamicResources(int category_p)
           
 String getMasterRole()
          get the role that is currently selected for the user
 String getMasterRoleDisplayName(Locale locale_p, String strRole_p)
          get a displayname for the given role
 Collection getMasterRoles()
          get a list of roles that can be selected for the current user
protected  Map getPrecalculatedSimpleAccessMasks()
           
 boolean hasAccessMaskRight(int iCategory_p, String strResourceID_p, int requiredAccessMask_p)
          checks if the current user designated by its credentials is allowed to use the given resource and has the required right in its access mask for that resource.
 boolean hasMasterRoles()
          check if selectable roles are supported by rolemanager for the current user
 boolean isAllowed(int iCategory_p, String strResourceID_p)
          checks if the current user designated by its credentials is allowed to use the given resource / function
 boolean isGlobalRoleModificationAllowed()
          Check if the current user is allowed to modify global roles, which are not bound to a specific mandator.
 void replaceResource(String roleName_p, int category_p, String oldResourceId_p, String newResourceId_p)
          Replaces the given dynamic old resource with a new one for its occurrences in access settings entries corresponding to the given role.
 void setAccessMask(String roleName_p, int category_p, String resourceId_p, int accessMask_p)
          Set the access mask for this resource.
 void setAccessRights(String roleName_p, int category_p, String resourceId_p, int accessRights_p)
          Persists the access rights for a given role to a given resource.
 boolean setMasterRole(String strRole_p)
          set the role that is currently selected for the user
 
Methods inherited from class com.wewebu.ow.server.role.OwStandardRoleManager
applicationInitalize, canRefreshStaticConfiguration, getAccessMaskDescriptions, getCategories, getCategoryDisplayName, getCategoryMap, getConfigNode, getConfiguredCategories, getContext, getCurrentUser, getDefaultMIMENode, getDesign, getDesignCategoryMap, getGroupBoxCategoryMap, getIndexFieldsMap, getMIMENode, getObjectClassesMap, getPlugin, getPluginCategoryMap, getPlugins, getRepositories, getResourceDisplayName, getResources, getSearchTemplateCategoryMap, getStandardFunctionResourceMap, getVirtualFoldersCategoryMap, init, isGlobalRole, isInitialized, isMsOfficeEmbedded, isStaticResourceCategory, loginInit, refreshStaticConfiguration, updateAllowedPlugins
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OwSimpleRoleManager

public OwSimpleRoleManager()
Method Detail

isAllowed

public boolean isAllowed(int iCategory_p,
                         String strResourceID_p)
                  throws Exception
checks if the current user designated by its credentials is allowed to use the given resource / function

Parameters:
iCategory_p - of the requested function
strResourceID_p - String ID of the requested resource (function / plugin id)
Returns:
true if user has permission, false if permission is denied
Throws:
Exception

hasAccessMaskRight

public boolean hasAccessMaskRight(int iCategory_p,
                                  String strResourceID_p,
                                  int requiredAccessMask_p)
                           throws Exception
checks if the current user designated by its credentials is allowed to use the given resource and has the required right in its access mask for that resource.

Parameters:
iCategory_p - of the requested function
strResourceID_p - String ID of the requested resource (function / plugin id)
requiredAccessMask_p - a 32 bit bitset with all flags set that have to be checked for the current user
Returns:
true if user has permission, false if permission is denied
Throws:
Exception

getAccessRights

public int getAccessRights(String roleName_p,
                           int category_p,
                           String resourceId_p)
                    throws Exception
Retrieves the access rights for a given role to a given resource.

Parameters:
roleName_p - the name of the role to retrieve the access rights for
category_p - the category of the resource to retrieve the access rights for
resourceId_p - the ID of the resource to retrieve the access rights for
Returns:
one of the ROLE_ACCESS_RIGHT_ constants
Throws:
Exception
See Also:
OwRoleManager.ROLE_ACCESS_RIGHT_NOT_ALLOWED, OwRoleManager.ROLE_ACCESS_RIGHT_ALLOWED, OwRoleManager.ROLE_ACCESS_RIGHT_DENIED

getAllowedResources

public Collection getAllowedResources(int category_p)
                               throws Exception
get all resources the current user has access to for a given category

Parameters:
category_p - int category for given user
Returns:
Collection of String (resource IDs)
Throws:
Exception

getMasterRoles

public Collection getMasterRoles()
                          throws Exception
get a list of roles that can be selected for the current user

Returns:
Collection of String, or null if no roles can be selected
Throws:
Exception

getMasterRoleDisplayName

public String getMasterRoleDisplayName(Locale locale_p,
                                       String strRole_p)
                                throws Exception
get a displayname for the given role

Parameters:
locale_p - Locale to use
strRole_p - String
Returns:
String displayname for given role
Throws:
Exception

getMasterRole

public String getMasterRole()
                     throws Exception
get the role that is currently selected for the user

Returns:
String role, or null if no roles can be selected
Throws:
Exception

setMasterRole

public boolean setMasterRole(String strRole_p)
                      throws Exception
set the role that is currently selected for the user

Parameters:
strRole_p - String
Returns:
boolean true = role changed
Throws:
Exception

hasMasterRoles

public boolean hasMasterRoles()
check if selectable roles are supported by rolemanager for the current user

Returns:
boolean true = given user has roles

setAccessRights

public void setAccessRights(String roleName_p,
                            int category_p,
                            String resourceId_p,
                            int accessRights_p)
                     throws Exception
Description copied from interface: OwRoleManager
Persists the access rights for a given role to a given resource.

Parameters:
roleName_p - name of the role to set the access rights for
category_p - category of the resource to set the access rights for
resourceId_p - ID of the resource to set the access rights for
accessRights_p - the new access rights to persist as one of the ROLE_ACCESS_RIGHT_ constants
Throws:
Exception
See Also:
OwRoleManager.ROLE_ACCESS_RIGHT_NOT_ALLOWED, OwRoleManager.ROLE_ACCESS_RIGHT_ALLOWED, OwRoleManager.ROLE_ACCESS_RIGHT_DENIED

canExplicitDeny

public boolean canExplicitDeny()
Description copied from interface: OwRoleManager
Check if rolemanager supports explicit deny of resources.

Returns:
true = Explicit deny is supported false = Explicit deny is not supported

isGlobalRoleModificationAllowed

public boolean isGlobalRoleModificationAllowed()
Description copied from interface: OwRoleManager
Check if the current user is allowed to modify global roles, which are not bound to a specific mandator.

Returns:
true = current user is allowed to modify global roles false = current user is not allowed to modify global roles

getPrecalculatedSimpleAccessMasks

protected Map getPrecalculatedSimpleAccessMasks()

getAccessMask

public int getAccessMask(String roleName_p,
                         int category_p,
                         String resourceId_p)
Description copied from interface: OwRoleManager
Get the access mask for this resource.

Parameters:
roleName_p - the name of the role to retrieve the access mask for
category_p - the category of the resource to retrieve the access mask for
resourceId_p - the ID of the resource to retrieve the access mask for
Returns:
the access mask for this resource as an ORed collection of access flags retrieved by getAccessMaskDescriptions

setAccessMask

public void setAccessMask(String roleName_p,
                          int category_p,
                          String resourceId_p,
                          int accessMask_p)
                   throws Exception
Description copied from interface: OwRoleManager
Set the access mask for this resource.

Parameters:
roleName_p - name of the role to set the access mask for
category_p - category of the resource to set the access mask for
resourceId_p - ID of the resource to set the access mask for
accessMask_p - the new access mask
Throws:
Exception

canPersistAccessMask

public boolean canPersistAccessMask()
Description copied from interface: OwRoleManager
Check if the rolemanager can persist changes on the access mask. If not, the getAccessMask() method will always return a full access mask

Returns:
true = Explicit deny is supported false = Explicit deny is not supported

getDynamicResources

protected Collection<String> getDynamicResources(int category_p)
Specified by:
getDynamicResources in class OwStandardRoleManager
Returns:
Collection of resource ids of dynamic resources associated with the given category

replaceResource

public void replaceResource(String roleName_p,
                            int category_p,
                            String oldResourceId_p,
                            String newResourceId_p)
                     throws Exception
Description copied from interface: OwRoleManager
Replaces the given dynamic old resource with a new one for its occurrences in access settings entries corresponding to the given role.

Throws:
Exception

dynamicResourceNameFromId

protected String dynamicResourceNameFromId(Locale locale_p,
                                           String resourceId_p,
                                           int category_p)
Specified by:
dynamicResourceNameFromId in class OwStandardRoleManager
Returns:
the localized display name of the resource with the given id


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.