com.wewebu.ow.server.role
Class OwStandardRoleManager

java.lang.Object
  extended by com.wewebu.ow.server.role.OwStandardRoleManager
All Implemented Interfaces:
OwRoleManager
Direct Known Subclasses:
OwSimpleRoleManager

public abstract class OwStandardRoleManager
extends Object
implements OwRoleManager

Standard implementation for the rolemanager.
Override this class to implement your own rolemanager and set the rolemanager in the bootstrap settings.
You get a instance of the RoleManager by calling getContext().getRoleManager().

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
static class OwStandardRoleManager.CategoryNames
           Inner class that holds the mapping of the categories to category names.
static class OwStandardRoleManager.StandardFunctionResources
           Inner class that holds the map that maps the standard function IDs to display names.
 
Field Summary
static String APPLICATION_PREFIX_DELIMITER
          delimiter for the resource ID and the application prefix
protected  Map m_AllowedPluginTypesMap
          map to the lists of plugin description nodes, DO NEVER access directly, rather use getAllowedPluginsMap() The allowed plugin map maps only those plugins which the logged on user has access rights.
protected  OwXMLUtil m_ConfigNode
          configuration node with XML config information
protected  Map m_DefaultMimeMap
          default MIME table with the default MIME types when mimetype could not be resolved, DO NEVER access directly, rather use getDefaultMimeMap() The MIME table is static, so it get only loaded once upon application server startup and not each time a user logs on.
protected  Map m_DesignCategoryMap
          a map of resources for the category: design
protected  Map m_GroupBoxCategoryMap
          a map of resources for the category: search template
protected  Map m_indexFieldsMap
          a map of resources for category: object classes
protected  Map m_MimeMap
          MIME table, DO NEVER access directly, rather use getMimeMap() The MIME table is static, so it get only loaded once upon application server startup and not each time a user logs on.
protected  Map m_objectClassesMap
          a map of resources for category: object classes
protected  Map m_PluginCategoryMap
          a map of resources for the plugins
protected  Map m_PluginMap
          map to the description nodes, keyed by their id, DO NEVER access directly, rather use getPlugin() The plugin map is static, so it gets only loaded once upon application server startup and not each time a user logs on.
protected  Map m_PluginTypesMap
          map to the lists of plugin description nodes, keyed by their type DO NEVER access directly, rather use getAllowedPluginsMap() The plugin map is static, so it gets only loaded once upon application server startup and not each time a user logs on.
protected  Map m_SearchTemplateCategoryMap
          a map of resources for the category: search template
protected  Map m_SelectiveConfigurationMap
          map of all selective configuration names (elements with a "optionid" attribute) in the config files.
protected  String m_strDesign
          the design name
protected  Map<String,String> m_VirtualFolderCategoryMap
          a map of resources for the category: virtual folder
static String MS_OFFICE_EMBEDED_DESIGN
          special office design to use in case we run embedded in msoffice
 
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
OwStandardRoleManager()
           
 
Method Summary
static void applicationInitalize(OwBaseInitializer initializer_p)
          Init role config data upon startup, make sure the servlet listener OwStandardRoleManagerInitialisingContextListener is configured for your application.
 boolean canRefreshStaticConfiguration()
          check if update the configuration data is supported
protected abstract  String dynamicResourceNameFromId(Locale locale_p, String resourceId_p, int category_p)
           
 Map getAccessMaskDescriptions(int category_p)
          Returns a map between the access right flag and the localized display name.
 Collection getCategories()
          get all defined categories and displaynames as a map
 String getCategoryDisplayName(Locale locale_p, int categorie_p)
          get a display name for the given category
protected  Map getCategoryMap()
          the map that maps the categories to category names
protected  OwXMLUtil getConfigNode()
          get configuration node with XML config information
 Collection getConfiguredCategories()
          Get configured categories and displaynames as a map.
protected  OwRoleManagerContext getContext()
          get the application context
protected  OwBaseUserInfo getCurrentUser()
          get the current logged on user
 OwXMLUtil getDefaultMIMENode(int iObjectType_p)
          get the default MIME XML Entry for the given object type.
 String getDesign()
          get the name of the design for the current user can be overridden by rolemanager implementation Specifies the subfolder under /designs/ where to retrieve the design files.
protected  Map getDesignCategoryMap()
          get a map of resources for the category: design
protected abstract  Collection<String> getDynamicResources(int category_p)
           
protected  Map getGroupBoxCategoryMap()
          get a map of resources for the category: search template
protected  Map getIndexFieldsMap()
          get a map of resources for the category: index fields
 OwXMLUtil getMIMENode(String strMIMEType_p)
          get the MIME XML Entry for the given MIMEType.
protected  Map getObjectClassesMap()
          get a map of resources for the category: object classes
 OwXMLUtil getPlugin(String strID_p)
          get a plugin description by its key that are allowed for the logged on user.
protected  Map getPluginCategoryMap()
          get a map of resources for the plugins
 List getPlugins(String strType_p)
          get a list of plugin description nodes by type as defined in OwBaseConfiguration, that are allowed for the logged on user.
protected  Map getRepositories()
          overridable, create a map of repositories that can be searched
 String getResourceDisplayName(Locale locale_p, int categorie_p, String strID_p)
          get a display name for the given category
 Collection getResources(int category_p)
          get all available resources for a given category
protected  Map getSearchTemplateCategoryMap()
          get a map of resources for the category: search template
protected  Map getStandardFunctionResourceMap()
          the map that maps the standard function IDs to display names
protected  Map<String,String> getVirtualFoldersCategoryMap()
          get a map of resources for the category: virtual folders
 void init(OwRoleManagerContext mainContext_p, OwXMLUtil configNode_p)
          init the manager, set context optionally set a prefix to distinguish several different applications.
 boolean isGlobalRole(String rolename_p)
          Determine if the given role name is a global role or a mandator specific role.
protected  boolean isInitialized()
          true after login init
protected  boolean isMsOfficeEmbedded()
          check if we run embedded in office
 boolean isStaticResourceCategory(int category_p)
           
 void loginInit()
          init called AFTER the user has logged in.
 void refreshStaticConfiguration()
          update the configuration data
protected  void updateAllowedPlugins()
          update the allowed plugins after role change
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.wewebu.ow.server.role.OwRoleManager
canExplicitDeny, canPersistAccessMask, getAccessMask, getAccessRights, getAllowedResources, getMasterRole, getMasterRoleDisplayName, getMasterRoles, hasAccessMaskRight, hasMasterRoles, isAllowed, isGlobalRoleModificationAllowed, replaceResource, setAccessMask, setAccessRights, setMasterRole
 

Field Detail

MS_OFFICE_EMBEDED_DESIGN

public static final String MS_OFFICE_EMBEDED_DESIGN
special office design to use in case we run embedded in msoffice

See Also:
Constant Field Values

APPLICATION_PREFIX_DELIMITER

public static final String APPLICATION_PREFIX_DELIMITER
delimiter for the resource ID and the application prefix

See Also:
Constant Field Values

m_ConfigNode

protected OwXMLUtil m_ConfigNode
configuration node with XML config information


m_MimeMap

protected Map m_MimeMap
MIME table, DO NEVER access directly, rather use getMimeMap() The MIME table is static, so it get only loaded once upon application server startup and not each time a user logs on.


m_DefaultMimeMap

protected Map m_DefaultMimeMap
default MIME table with the default MIME types when mimetype could not be resolved, DO NEVER access directly, rather use getDefaultMimeMap() The MIME table is static, so it get only loaded once upon application server startup and not each time a user logs on.


m_PluginTypesMap

protected Map m_PluginTypesMap
map to the lists of plugin description nodes, keyed by their type DO NEVER access directly, rather use getAllowedPluginsMap() The plugin map is static, so it gets only loaded once upon application server startup and not each time a user logs on.


m_PluginMap

protected Map m_PluginMap
map to the description nodes, keyed by their id, DO NEVER access directly, rather use getPlugin() The plugin map is static, so it gets only loaded once upon application server startup and not each time a user logs on.


m_AllowedPluginTypesMap

protected Map m_AllowedPluginTypesMap
map to the lists of plugin description nodes, DO NEVER access directly, rather use getAllowedPluginsMap() The allowed plugin map maps only those plugins which the logged on user has access rights. Must not be static, because it is created for each user-session.


m_SelectiveConfigurationMap

protected Map m_SelectiveConfigurationMap
map of all selective configuration names (elements with a "optionid" attribute) in the config files. DO NEVER access directly, rather use getResources(ROLE_CATEGORY_SELECTIVE_CONFIGURATION);


m_strDesign

protected String m_strDesign
the design name


m_PluginCategoryMap

protected Map m_PluginCategoryMap
a map of resources for the plugins


m_DesignCategoryMap

protected Map m_DesignCategoryMap
a map of resources for the category: design


m_SearchTemplateCategoryMap

protected Map m_SearchTemplateCategoryMap
a map of resources for the category: search template


m_VirtualFolderCategoryMap

protected Map<String,String> m_VirtualFolderCategoryMap
a map of resources for the category: virtual folder


m_GroupBoxCategoryMap

protected Map m_GroupBoxCategoryMap
a map of resources for the category: search template


m_objectClassesMap

protected Map m_objectClassesMap
a map of resources for category: object classes


m_indexFieldsMap

protected Map m_indexFieldsMap
a map of resources for category: object classes

Constructor Detail

OwStandardRoleManager

public OwStandardRoleManager()
Method Detail

getCategoryMap

protected Map getCategoryMap()
the map that maps the categories to category names


getStandardFunctionResourceMap

protected Map getStandardFunctionResourceMap()
the map that maps the standard function IDs to display names


isInitialized

protected boolean isInitialized()
true after login init


getConfigNode

protected OwXMLUtil getConfigNode()
get configuration node with XML config information


getCurrentUser

protected OwBaseUserInfo getCurrentUser()
                                 throws Exception
get the current logged on user

Returns:
OwUserInfo
Throws:
Exception

applicationInitalize

public static void applicationInitalize(OwBaseInitializer initializer_p)
                                 throws OwConfigurationException
Init role config data upon startup, make sure the servlet listener OwStandardRoleManagerInitialisingContextListener is configured for your application.

Parameters:
initializer_p -
Throws:
OwConfigurationException

refreshStaticConfiguration

public void refreshStaticConfiguration()
                                throws OwConfigurationException
update the configuration data

Specified by:
refreshStaticConfiguration in interface OwRoleManager
Throws:
OwConfigurationException

canRefreshStaticConfiguration

public boolean canRefreshStaticConfiguration()
                                      throws Exception
check if update the configuration data is supported

Specified by:
canRefreshStaticConfiguration in interface OwRoleManager
Throws:
Exception

init

public void init(OwRoleManagerContext mainContext_p,
                 OwXMLUtil configNode_p)
          throws OwException
init the manager, set context optionally set a prefix to distinguish several different applications. The rolemanager will filter the allowed plugins, MIME settings and design with the prefix. The default is empty. e.g. used for the Zero-Install Desktop Integration (ZIDI) to display a different set of plugins, MIME table and design for the Zero-Install Desktop Integration (ZIDI)

Specified by:
init in interface OwRoleManager
Parameters:
configNode_p - OwXMLUtil node with configuration information
mainContext_p - reference to the main app context of the application
Throws:
OwException

isMsOfficeEmbedded

protected boolean isMsOfficeEmbedded()
check if we run embedded in office


loginInit

public void loginInit()
               throws Exception
init called AFTER the user has logged in. NOTE: This function is called only once after login to do special initialization, which can only be performed with valid credentials.

Specified by:
loginInit in interface OwRoleManager
Throws:
Exception

getContext

protected OwRoleManagerContext getContext()
get the application context

Returns:
OwMainAppContext

getDesign

public String getDesign()
                 throws Exception
get the name of the design for the current user can be overridden by rolemanager implementation Specifies the subfolder under /designs/ where to retrieve the design files. i.e. css, images, layouts... This function can be used to make the look & feel dependent on the logged in user.

Specified by:
getDesign in interface OwRoleManager
Returns:
name of design to use, default = "default"
Throws:
Exception

getPlugins

public List getPlugins(String strType_p)
                throws Exception
get a list of plugin description nodes by type as defined in OwBaseConfiguration, that are allowed for the logged on user.

Specified by:
getPlugins in interface OwRoleManager
Returns:
list of plugins for the given type or null if not found
Throws:
Exception

getPlugin

public OwXMLUtil getPlugin(String strID_p)
                    throws Exception
get a plugin description by its key that are allowed for the logged on user.

Specified by:
getPlugin in interface OwRoleManager
Returns:
OwXMLUtil or null if not found
Throws:
Exception

updateAllowedPlugins

protected void updateAllowedPlugins()
update the allowed plugins after role change


getMIMENode

public OwXMLUtil getMIMENode(String strMIMEType_p)
                      throws Exception
get the MIME XML Entry for the given MIMEType. Lookup in MimeMap that are allowed for the logged on user.
 <?xml version="1.0" ?>
   <mimetable>
      <mime typ="file/txt">
         <icon>file_txt.png</icon>
         <viewerservlet>getConent</viewerservlet>
      </mime>
      <!-- further MIME entries-->
  </mimetable>
 

Specified by:
getMIMENode in interface OwRoleManager
Parameters:
strMIMEType_p - OwObject MIMEType
Returns:
OwXMLUtil wrapped DOM Node of MIME entry from MIME table, or null if not found
Throws:
Exception

getDefaultMIMENode

public OwXMLUtil getDefaultMIMENode(int iObjectType_p)
                             throws Exception
get the default MIME XML Entry for the given object type. that are allowed for the logged on user.

Specified by:
getDefaultMIMENode in interface OwRoleManager
Parameters:
iObjectType_p - Objecttype
Returns:
OwXMLUtil wrapped DOM Node of MIME entry from MIME table, or null if not found
Throws:
Exception

getCategories

public Collection getCategories()
get all defined categories and displaynames as a map

Specified by:
getCategories in interface OwRoleManager
Returns:
Map of Integer keys (categories)

getConfiguredCategories

public Collection getConfiguredCategories()
Description copied from interface: OwRoleManager
Get configured categories and displaynames as a map. If no categories are configured, all categories are returned.

Specified by:
getConfiguredCategories in interface OwRoleManager
Returns:
- a Collection of Integer keys (categories).

getCategoryDisplayName

public String getCategoryDisplayName(Locale locale_p,
                                     int categorie_p)
get a display name for the given category

Specified by:
getCategoryDisplayName in interface OwRoleManager
Parameters:
locale_p - Locale to use
categorie_p - Integer from getCategories() method

getPluginCategoryMap

protected Map getPluginCategoryMap()
get a map of resources for the plugins


getDesignCategoryMap

protected Map getDesignCategoryMap()
get a map of resources for the category: design

Returns:
map of design resources

getRepositories

protected Map getRepositories()
overridable, create a map of repositories that can be searched


getVirtualFoldersCategoryMap

protected Map<String,String> getVirtualFoldersCategoryMap()
                                                   throws Exception
get a map of resources for the category: virtual folders

Returns:
map of virtual folder resources
Throws:
Exception
Since:
4.0.0.0

getSearchTemplateCategoryMap

protected Map getSearchTemplateCategoryMap()
                                    throws Exception
get a map of resources for the category: search template

Returns:
map of search template resources
Throws:
Exception

getGroupBoxCategoryMap

protected Map getGroupBoxCategoryMap()
                              throws Exception
get a map of resources for the category: search template

Returns:
map of search template resources
Throws:
Exception

getObjectClassesMap

protected Map getObjectClassesMap()
                           throws Exception
get a map of resources for the category: object classes

Returns:
map of object classes resources
Throws:
Exception

getIndexFieldsMap

protected Map getIndexFieldsMap()
                         throws Exception
get a map of resources for the category: index fields

Returns:
map of index fields resources
Throws:
Exception

dynamicResourceNameFromId

protected abstract String dynamicResourceNameFromId(Locale locale_p,
                                                    String resourceId_p,
                                                    int category_p)
Parameters:
locale_p -
resourceId_p -
category_p -
Returns:
the localized display name of the resource with the given id
Since:
4.0.0.0

isStaticResourceCategory

public boolean isStaticResourceCategory(int category_p)
Specified by:
isStaticResourceCategory in interface OwRoleManager
Returns:
true if the given category is a static resource category (i.e. categories that have a predefined resource set associated with them - new resources can not be added directly)

getDynamicResources

protected abstract Collection<String> getDynamicResources(int category_p)
                                                   throws OwException
Parameters:
category_p -
Returns:
Collection of resource ids of dynamic resources associated with the given category
Throws:
OwException
Since:
4.0.0.0

getResources

public Collection getResources(int category_p)
                        throws Exception
get all available resources for a given category

Specified by:
getResources in interface OwRoleManager
Parameters:
category_p - int category
Returns:
Map of String keys (resource IDs)
Throws:
Exception

getResourceDisplayName

public String getResourceDisplayName(Locale locale_p,
                                     int categorie_p,
                                     String strID_p)
get a display name for the given category

Specified by:
getResourceDisplayName in interface OwRoleManager
Parameters:
locale_p - Locale to use
categorie_p - Integer from getCategories() method
strID_p - String resource id

getAccessMaskDescriptions

public Map getAccessMaskDescriptions(int category_p)
Returns a map between the access right flag and the localized display name. All checked access right flags are ORed together and form the int value of the access mask.

Specified by:
getAccessMaskDescriptions in interface OwRoleManager
Parameters:
category_p - the category to retrieve the flag map for
Returns:
Map between Integer and String mapping the access mask flags to their display names

isGlobalRole

public boolean isGlobalRole(String rolename_p)
Determine if the given role name is a global role or a mandator specific role.

Specified by:
isGlobalRole in interface OwRoleManager
Parameters:
rolename_p - the name of the role to check
Returns:
true = rolename_p is a global role false = rolename_p is a mandator specific role


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.