public class UserRoleActivationStrategy extends Object implements ActivationStrategy
| Modifier and Type | Field and Description |
|---|---|
static String |
ID |
static String |
NAME |
static String |
PARAM_ROLES_DESC |
static String |
PARAM_ROLES_LABEL |
static String |
PARAM_ROLES_NAME |
static String |
USER_ATTRIBUTE_ROLES |
| Constructor and Description |
|---|
UserRoleActivationStrategy() |
| Modifier and Type | Method and Description |
|---|---|
String |
getId()
A unique id for this strategy.
|
String |
getName()
A human readable name of the strategy.
|
Parameter[] |
getParameters()
Returns the list of configuration parameter definitions for the strategy.
|
boolean |
isActive(FeatureState state,
FeatureUser user)
This method is responsible to decide whether a feature is active or not.
|
public static final String ID
public static final String NAME
public static final String PARAM_ROLES_NAME
public static final String PARAM_ROLES_LABEL
public static final String PARAM_ROLES_DESC
public static final String USER_ATTRIBUTE_ROLES
public String getId()
ActivationStrategyStateRepository.getId in interface ActivationStrategypublic String getName()
ActivationStrategygetName in interface ActivationStrategypublic boolean isActive(FeatureState state, FeatureUser user)
ActivationStrategyisActive in interface ActivationStrategystate - The feature state which represents the current configuration of the feature. The implementation of
the method typically uses FeatureState.getParameter(String) to access custom configuration paramater
values.user - The user for which to decide whether the feature is active. May be null if the user could not be
identified by the UserProvider.true if the feature should be active, else falsepublic Parameter[] getParameters()
ActivationStrategy
Returns the list of configuration parameter definitions for the strategy. Parameters are typically built using a
ParameterBuilder class but users can also create custom implementations of the Parameter interface.
Example:
public Parameter[] getParameters() {
return new Parameter[] {
ParameterBuilder.create("country").label("Country Code").matching("[A-Z]+")
};
}
getParameters in interface ActivationStrategyParameterBuilderCopyright © 2018. All Rights Reserved.