View source: R/feature_flag-connect_user.R
is_enabled.connect_user_feature_flag | R Documentation |
Checks if the given connect user feature flag is enabled
## S3 method for class 'connect_user_feature_flag'
is_enabled(feature_flag)
feature_flag |
flag to be checked whether it is enabled |
The session$user field is used for retrieving the information on the logged-in user
TRUE if the feature flag is enabled.
{
flag <- create_connect_user_feature_flag(c("user1"))
# Returns TRUE if the session$user matches the specified users
mock_session <- shiny::MockShinySession$new()
mock_session$user <- "user1"
shiny::withReactiveDomain(
domain = mock_session,
expr = is_enabled(flag)
)
# Returns FALSE if the session$user does not match the specified users
mock_session <- shiny::MockShinySession$new()
mock_session$user <- "user2"
shiny::withReactiveDomain(
domain = mock_session,
expr = is_enabled(flag)
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.