public class CheckRightsCondition extends AbstractWorkflowComponent implements com.opensymphony.workflow.Condition, Initializable, Disposable
 The following configuration can be used for checking rights:
 
<condition type="avalon"> <arg name="role">org.ametys.plugins.workflow.component.CheckRightsCondition</arg> <arg name="right">Right_Edition</arg> [ <arg name="context">/cms</arg>] </condition>
| Modifier and Type | Field and Description | 
|---|---|
| protected static String | __CONTEXT_KEYKey for getting the context to use. | 
| protected static String | __DEFAULT_CONTEXTDefault context to use. | 
| protected static String | __RIGHT_KEYKey for getting the right to check. | 
| protected RightManager | _rightManagerRights manager available to subclasses. | 
| static String | FORCEBoolean to force the CheckRightsCondition to returns ok. | 
_logger, _manager, CONTEXT_PARAMETERS_KEY, FAIL_CONDITIONS_KEY, RESULT_MAP_KEY, WORKFLOW_ERRORS_KEY, WORKFLOW_WARNS_KEY| Constructor and Description | 
|---|
| CheckRightsCondition() | 
| Modifier and Type | Method and Description | 
|---|---|
| protected boolean | _checkRights(Map transientVars,
            Map args,
            UserIdentity user,
            String rightNeeded)Check if the current user has the needed right. | 
| protected Object | _computeContext(Map transientVars,
               Map args,
               UserIdentity user,
               String right)Compute the context to use. Default implementation uses standard context "/cms". | 
| protected boolean | checkMultipleAndRights(UserIdentity user,
                      String[] rights,
                      Object context)Check that a user has all the given rights on a context (AND condition). | 
| protected boolean | checkMultipleOrRights(UserIdentity user,
                     String[] rights,
                     Object context)Check that a user has at least one of the given rights on a context (OR condition). | 
| void | dispose() | 
| protected boolean | hasRight(UserIdentity user,
        String right,
        Object context)Test if a user has a right on a context. | 
| void | initialize() | 
| boolean | passesCondition(Map transientVars,
               Map args,
               com.opensymphony.module.propertyset.PropertySet ps) | 
addWorkflowError, addWorkflowWarning, enableLogging, getConditionFailures, getContextParameters, getResultsMap, getUser, serviceprotected static final String __DEFAULT_CONTEXT
protected static final String __RIGHT_KEY
protected static final String __CONTEXT_KEY
protected RightManager _rightManager
public CheckRightsCondition()
public void initialize() throws Exception
initialize in interface InitializableExceptionpublic boolean passesCondition(Map transientVars, Map args, com.opensymphony.module.propertyset.PropertySet ps) throws com.opensymphony.workflow.WorkflowException
passesCondition in interface com.opensymphony.workflow.Conditioncom.opensymphony.workflow.WorkflowExceptionprotected boolean _checkRights(Map transientVars, Map args, UserIdentity user, String rightNeeded) throws com.opensymphony.workflow.WorkflowException
transientVars - variables that will not be persisted.args - the properties for this function invocation.user - the current user.rightNeeded - the needed right.true if the user has the right, false
         otherwise.com.opensymphony.workflow.WorkflowException - if an error occurs.protected boolean checkMultipleAndRights(UserIdentity user, String[] rights, Object context)
user - the user.rights - the rights to check.context - the right context.protected boolean checkMultipleOrRights(UserIdentity user, String[] rights, Object context)
user - the user.rights - the rights to check.context - the right context.protected boolean hasRight(UserIdentity user, String right, Object context)
user - the userright - the right to check.context - the right context.protected Object _computeContext(Map transientVars, Map args, UserIdentity user, String right) throws com.opensymphony.workflow.WorkflowException
"/cms".transientVars - variables that will not be persisted.args - the properties for this function invocation.user - the current user.right - the needed right.com.opensymphony.workflow.WorkflowException - if an error occurs.public void dispose()
dispose in interface Disposable