is_enabled.connect_group_feature_flag: Checks if the given connect group feature flag is enabled

View source: R/feature_flag-connect_group.R

is_enabled.connect_group_feature_flagR Documentation

Checks if the given connect group feature flag is enabled

Description

Checks if the given connect group feature flag is enabled

Usage

## S3 method for class 'connect_group_feature_flag'
is_enabled(feature_flag)

Arguments

feature_flag

flag to be checked whether it is enabled

Details

The session$groups field is used for retrieving the information on the logged-in user groups

Value

TRUE if the logged in user belongs to a group defined in the feature flag

Examples

{
  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)
  )
}

featureflag documentation built on April 4, 2025, 5:45 a.m.