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.
|
Optional<Boolean> |
isEnabledForAllUsers(String featureKey)
Checks whether the product contains the given feature for all users, regardless whether the feature can be
changed during runtime or not.
|
Optional<Boolean> |
isEnabledForCurrentUser(String featureKey)
Checks whether the product contains the given feature for all users or for the current user only
(must be called within the context of a request).
|
Optional<Boolean> |
isEnabledForUser(UserKey userKey,
String featureKey)
Checks whether the product contains the given feature for all users or just for the given user.
|
boolean |
isFeatureEnabledForAllUsers(String featureKey)
Deprecated.
|
boolean |
isFeatureEnabledForCurrentUser(String featureKey)
Deprecated.
|
boolean |
isFeatureEnabledForUser(UserKey userKey,
String featureKey)
Deprecated.
|
public DefaultDarkFeatureManager(UserManager userManager, SiteDarkFeaturesStorage siteDarkFeaturesStorage)
@Nonnull public Optional<Boolean> isEnabledForAllUsers(@Nonnull String featureKey)
DarkFeatureManagerisEnabledForAllUsers in interface DarkFeatureManagerfeatureKey - key of the feature to be checkedtrue if the feature key is valid and enabled, false otherwise;
Optional.empty() when the featureKey is not know or is invalid as per
ValidFeatureKeyPredicate.isValidFeatureKey(String)ValidFeatureKeyPredicate@Nonnull public Optional<Boolean> isEnabledForCurrentUser(@Nonnull String featureKey)
DarkFeatureManagerisEnabledForCurrentUser in interface DarkFeatureManagerfeatureKey - 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. Optional.empty() when the featureKey is not know or is invalid
as per ValidFeatureKeyPredicate.isValidFeatureKey(String)ValidFeatureKeyPredicate@Nonnull public Optional<Boolean> isEnabledForUser(@Nullable UserKey userKey, @Nonnull String featureKey)
DarkFeatureManagerisEnabledForUser in interface DarkFeatureManageruserKey - 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; Optional.empty() when the featureKey is not know or is invalid
as per ValidFeatureKeyPredicate.isValidFeatureKey(String)ValidFeatureKeyPredicate@Deprecated public boolean isFeatureEnabledForAllUsers(String featureKey)
DarkFeatureManagerisFeatureEnabledForAllUsers in interface DarkFeatureManagerfeatureKey - key of the feature to be checkedtrue if the feature key is valid and enabled, false otherwiseValidFeatureKeyPredicate@Deprecated public boolean isFeatureEnabledForCurrentUser(String featureKey)
DarkFeatureManagerisFeatureEnabledForCurrentUser in interface DarkFeatureManagerfeatureKey - 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@Deprecated public boolean isFeatureEnabledForUser(@Nullable UserKey userKey, String featureKey)
DarkFeatureManagerisFeatureEnabledForUser in interface DarkFeatureManageruserKey - 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.ValidFeatureKeyPredicatepublic boolean canManageFeaturesForAllUsers()
DarkFeatureManagercanManageFeaturesForAllUsers in interface DarkFeatureManagertrue iff the current acting user has permission to change dark features for all users,
false otherwisepublic void enableFeatureForAllUsers(String featureKey)
DarkFeatureManagerenableFeatureForAllUsers in interface DarkFeatureManagerfeatureKey - key of the feature to be enabledValidFeatureKeyPredicate,
DarkFeatureManager.canManageFeaturesForAllUsers()public void disableFeatureForAllUsers(String featureKey)
DarkFeatureManagerdisableFeatureForAllUsers in interface DarkFeatureManagerfeatureKey - key of the feature to be disabledValidFeatureKeyPredicate,
DarkFeatureManager.canManageFeaturesForAllUsers()public void enableFeatureForCurrentUser(String featureKey)
DarkFeatureManagerenableFeatureForCurrentUser in interface DarkFeatureManagerfeatureKey - key of the feature to enableValidFeatureKeyPredicatepublic void enableFeatureForUser(UserKey userKey, String featureKey)
DarkFeatureManagerenableFeatureForUser in interface DarkFeatureManageruserKey - key of the user to enable the feature for; not nullfeatureKey - key of the feature to be enabledValidFeatureKeyPredicatepublic void disableFeatureForCurrentUser(String featureKey)
DarkFeatureManagerdisableFeatureForCurrentUser in interface DarkFeatureManagerfeatureKey - key of the feature to be disabledValidFeatureKeyPredicatepublic void disableFeatureForUser(UserKey userKey, String featureKey)
DarkFeatureManagerdisableFeatureForUser in interface DarkFeatureManageruserKey - key of the user to disable the feature for; not nullfeatureKey - key of the feature to be disabledValidFeatureKeyPredicatepublic EnabledDarkFeatures getFeaturesEnabledForAllUsers()
getFeaturesEnabledForAllUsers in interface DarkFeatureManagerpublic EnabledDarkFeatures getFeaturesEnabledForCurrentUser()
DarkFeatureManagergetFeaturesEnabledForCurrentUser in interface DarkFeatureManagerpublic EnabledDarkFeatures getFeaturesEnabledForUser(@Nullable UserKey userKey)
DarkFeatureManagergetFeaturesEnabledForUser in interface DarkFeatureManageruserKey - key of the user being queried; null represents the anonymous userCopyright © 2018 Atlassian. All rights reserved.