public class DefaultDarkFeatureManager extends Object implements DarkFeatureManager
ATLASSIAN_DARKFEATURE_PREFIX, DARKFEATURES_PROPERTIES_FILE_PROPERTY, DARKFEATURES_PROPERTIES_FILE_PROPERTY_DEFAULT, DISABLE_ALL_DARKFEATURES_PROPERTY
Constructor and Description |
---|
DefaultDarkFeatureManager(UserManager userManager,
SiteDarkFeaturesStorage siteDarkFeaturesStorage) |
Modifier and Type | Method and Description |
---|---|
boolean |
canManageFeaturesForAllUsers()
Returns true if the current acting user has permission to change dark features for all users.
|
void |
disableFeatureForAllUsers(String featureKey)
Disable the given dark feature for all users.
|
void |
disableFeatureForCurrentUser(String featureKey)
Disable a dark feature for the current user only.
|
void |
disableFeatureForUser(UserKey userKey,
String featureKey)
Disable a dark feature for the given user only.
|
void |
enableFeatureForAllUsers(String featureKey)
Enable the given dark feature all users.
|
void |
enableFeatureForCurrentUser(String featureKey)
Enable a dark feature for the current user only.
|
void |
enableFeatureForUser(UserKey userKey,
String featureKey)
Enable a dark feature for the given user only.
|
EnabledDarkFeatures |
getFeaturesEnabledForAllUsers() |
EnabledDarkFeatures |
getFeaturesEnabledForCurrentUser()
Return features enabled for the current user (must be called within the context of a request).
|
EnabledDarkFeatures |
getFeaturesEnabledForUser(UserKey userKey)
Return enabled features for a given user.
|
boolean |
isFeatureEnabledForAllUsers(String featureKey)
Checks if a dark feature is enabled for all users, regardless whether the feature can be changed during runtime
or not.
|
boolean |
isFeatureEnabledForCurrentUser(String featureKey)
Checks if a dark feature is enabled for all users or for the current user only (must be called within the context
of a request).
|
boolean |
isFeatureEnabledForUser(UserKey userKey,
String featureKey)
Checks if a dark feature is enabled for all users or just for the given user.
|
public DefaultDarkFeatureManager(UserManager userManager, SiteDarkFeaturesStorage siteDarkFeaturesStorage)
public boolean isFeatureEnabledForAllUsers(String featureKey)
DarkFeatureManager
isFeatureEnabledForAllUsers
in interface DarkFeatureManager
featureKey
- key of the feature to be checkedtrue
if the feature key is valid and enabled, false otherwiseValidFeatureKeyPredicate
public boolean isFeatureEnabledForCurrentUser(String featureKey)
DarkFeatureManager
isFeatureEnabledForCurrentUser
in interface DarkFeatureManager
featureKey
- key of the feature to be checkedtrue
if the feature is valid and enabled, either for all users or the current user only;
false
otherwise.ValidFeatureKeyPredicate
public boolean isFeatureEnabledForUser(@Nullable UserKey userKey, String featureKey)
DarkFeatureManager
isFeatureEnabledForUser
in interface DarkFeatureManager
userKey
- the key of the user being queried; null
represents the anonymous userfeatureKey
- key of the feature to be checkedtrue
if the feature key is valid and enabled, either for all users or the current user only;
false
otherwise.ValidFeatureKeyPredicate
public boolean canManageFeaturesForAllUsers()
DarkFeatureManager
canManageFeaturesForAllUsers
in interface DarkFeatureManager
true
iff the current acting user has permission to change dark features for all users,
false
otherwisepublic void enableFeatureForAllUsers(String featureKey)
DarkFeatureManager
enableFeatureForAllUsers
in interface DarkFeatureManager
featureKey
- key of the feature to be enabledValidFeatureKeyPredicate
,
DarkFeatureManager.canManageFeaturesForAllUsers()
public void disableFeatureForAllUsers(String featureKey)
DarkFeatureManager
disableFeatureForAllUsers
in interface DarkFeatureManager
featureKey
- key of the feature to be disabledValidFeatureKeyPredicate
,
DarkFeatureManager.canManageFeaturesForAllUsers()
public void enableFeatureForCurrentUser(String featureKey)
DarkFeatureManager
enableFeatureForCurrentUser
in interface DarkFeatureManager
featureKey
- key of the feature to enableValidFeatureKeyPredicate
public void enableFeatureForUser(UserKey userKey, String featureKey)
DarkFeatureManager
enableFeatureForUser
in interface DarkFeatureManager
userKey
- key of the user to enable the feature for; not null
featureKey
- key of the feature to be enabledValidFeatureKeyPredicate
public void disableFeatureForCurrentUser(String featureKey)
DarkFeatureManager
disableFeatureForCurrentUser
in interface DarkFeatureManager
featureKey
- key of the feature to be disabledValidFeatureKeyPredicate
public void disableFeatureForUser(UserKey userKey, String featureKey)
DarkFeatureManager
disableFeatureForUser
in interface DarkFeatureManager
userKey
- key of the user to disable the feature for; not null
featureKey
- key of the feature to be disabledValidFeatureKeyPredicate
public EnabledDarkFeatures getFeaturesEnabledForAllUsers()
getFeaturesEnabledForAllUsers
in interface DarkFeatureManager
public EnabledDarkFeatures getFeaturesEnabledForCurrentUser()
DarkFeatureManager
getFeaturesEnabledForCurrentUser
in interface DarkFeatureManager
public EnabledDarkFeatures getFeaturesEnabledForUser(@Nullable UserKey userKey)
DarkFeatureManager
getFeaturesEnabledForUser
in interface DarkFeatureManager
userKey
- key of the user being queried; null
represents the anonymous userCopyright © 2015 Atlassian. All rights reserved.