Skip to content
  • has_group(identity, group) — is the person in group?

  • has_role(identity, group, role) — does the person hold role in group?

  • roles(identity, group) — every role the person holds in group (character(0) when none).

Usage

has_group(identity, group)

has_role(identity, group, role)

roles(identity, group)

Arguments

identity

An identity from sso_finish(), hosted_identity() or hosted_identity_plumber().

group

A group name.

role

A role name.

Value

TRUE/FALSE for has_group() and has_role(); a character vector for roles().

Details

These only report what the portal said. What a group or a role allows inside your app is your app's decision.

Examples

# A stand-in for a Shiny session inside the portal.
session <- list(request = list(
  HTTP_X_SP_USERID = "ana",
  HTTP_X_SP_USERGROUPS = "fiscal",
  HTTP_X_RUSCKER_USER_ROLES = "fiscal:analista,fiscal:gestor"
))
id <- hosted_identity(session)
has_group(id, "fiscal")
#> [1] TRUE
has_role(id, "fiscal", "gestor")
#> [1] TRUE
roles(id, "fiscal")
#> [1] "analista" "gestor"