View source: R/feature_flag-connect_group.R
is_enabled.connect_group_feature_flag | R Documentation |
Checks if the given connect group feature flag is enabled
## S3 method for class 'connect_group_feature_flag'
is_enabled(feature_flag)
feature_flag |
flag to be checked whether it is enabled |
The session$groups field is used for retrieving the information on the logged-in user groups
TRUE if the logged in user belongs to a group defined in the feature flag
{
flag <- create_connect_group_feature_flag(c("group1"))
# Returns TRUE when the logged-in user belongs to at least one of the specified groups
mock_session <- shiny::MockShinySession$new()
mock_session$groups <- "group1"
shiny::withReactiveDomain(
domain = mock_session,
expr = is_enabled(flag)
)
# Returns FALSE if session$groups does not have any of the specified groups
mock_session <- shiny::MockShinySession$new()
mock_session$user <- "group2"
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.