public class SlingshotSiteModuleEvaluator
extends java.lang.Object
implements org.springframework.extensions.surf.extensibility.ExtensionModuleEvaluator
Evaluator used to decide if an extension module (and its & ) shall be used for this request.
Makes it possible to decide if we are viewed specific sites based on their ids and sitePreset ids by matching them against the regexps inside the and parameters and the comma separated groups list in the parameter. The parameter decides if the groups list shall be matched using "and" or "or", allowed values are: AND and OR.
Note! If we are outside a side (i.e. a "global/non-site-page" page: i.e. the "Repository browser", A users dashboard or the
"My Workflows" page the evaluator will return true
by default. To change this behaviour you can set
to false, which means the evaluator will return true ONLY when inside a site.
Note that the parameter still applies even
Note! The regexp is expressed without using the surrounding // characters.
Example:
<evaluator type="site.module.evaluator">
<params>
<sitePresets>rm-site-dashboard</sitePresets>
<applyForNonSites>false</applyForNonSites>
</params>
</evaluator>
Will return true if we are inside a site with a sitePreset id of "rm-site-dashboard".
Example 2:
<evaluator type="site.module.evaluator">
<params>
<sites>rm|photos</sitePresets>
</params>
</evaluator>
Will return true if we are inside a site with a site id of "rm" or "photos" OR if we are on a global page.
Example 3:
<evaluator type="site.module.evaluator">
<params>
<sites>.*</sites>
<applyForNonSites>false</applyForNonSites>
<groups>SiteManager,SiteCollaborator</groups>
<groupsRelation>OR</groupsRelation>
</params>
</evaluator>
Will return true as long as we are in a site and the user is a SiteManager or SiteCollaborator.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
APPLY_FOR_NON_SITES |
static java.lang.String |
GROUPS |
static java.lang.String |
GROUPS_RELATION |
static java.lang.String |
GROUPS_RELATION_AND |
static java.lang.String |
SITE_FILTER |
static java.lang.String |
SITE_PRESET_FILTER |
protected SlingshotEvaluatorUtil |
util |
Constructor and Description |
---|
SlingshotSiteModuleEvaluator() |
Modifier and Type | Method and Description |
---|---|
boolean |
applyModule(org.springframework.extensions.surf.RequestContext context,
java.util.Map params)
Will return true if we are outside a site OR inside a site with a sitePreset id of "rm-site-dashboard".
|
java.lang.String[] |
getRequiredProperties() |
protected boolean |
isUserInGroups(org.springframework.extensions.surf.RequestContext context,
java.util.Map params)
Checks to see whether or not the current user satisfies the group membership requirements
specified.
|
void |
setSlingshotEvaluatorUtil(SlingshotEvaluatorUtil slingshotExtensibilityUtil) |
public static final java.lang.String SITE_PRESET_FILTER
public static final java.lang.String SITE_FILTER
public static final java.lang.String APPLY_FOR_NON_SITES
public static final java.lang.String GROUPS
public static final java.lang.String GROUPS_RELATION
public static final java.lang.String GROUPS_RELATION_AND
protected SlingshotEvaluatorUtil util
public void setSlingshotEvaluatorUtil(SlingshotEvaluatorUtil slingshotExtensibilityUtil)
public java.lang.String[] getRequiredProperties()
getRequiredProperties
in interface org.springframework.extensions.surf.extensibility.ExtensionModuleEvaluator
public boolean applyModule(org.springframework.extensions.surf.RequestContext context, java.util.Map params)
applyModule
in interface org.springframework.extensions.surf.extensibility.ExtensionModuleEvaluator
context
- params
- protected boolean isUserInGroups(org.springframework.extensions.surf.RequestContext context, java.util.Map params)
context
- params
- Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.