User attributes in container apps running behind shinyproxy
Source:R/userAttribute.R
userAttribute.Rd
For apps running as containers particular environment variables must be defined for an orderly handling of dynamic user privileges. This function makes use of environmental variables defined by shinyproxy to provide available privileges for the shiny application.
These are helper function for userInfo
. When used without a
shiny session object calls to these functions is made without any arguments.
If redefining contexts is needed, please use userInfo
instead.
Usage
userAttribute(group, unit = NULL)
getUserEmail(shinySession = NULL, group = NULL)
getUserFullName(shinySession = NULL, group = NULL)
getUserGroups(shinySession = NULL, group = NULL)
getUserName(shinySession = NULL, group = NULL)
getUserPhone(shinySession = NULL, group = NULL)
getUserReshId(shinySession = NULL, group = NULL)
getUserRole(shinySession = NULL, group = NULL)
Arguments
- group
Character string providing the name of the app R package name. The term "group" is used to relate to the environmental variable SHINYPROXY_USERGROUPS that corresponds to the apps a given user can access. Default value is NULL but should always be set when shiny app is run as a shinyproxy container.
- unit
Integer providing the look-up unit id. Default value is NULL in which case all privileges for
group
are returned.- shinySession
A shiny session object. Default value is NULL
Value
Invisibly a list of user metadata and privileges:
- name
The username for whom the privileges apply.
- fullName
User full name
- phone
User phone number
User email
- group
Group of which the user is a member.
- unit
Unit id under which the privileges are defined.
- org
Organization id for the user.
- role
Role of the user.
- orgName
Name of the organization as defined under the unit id.
String with user attribute
Examples
# \donttest{
# Requires a valid shiny session object
try(getUserEmail())
#> System has no defined instance. Configuration as provided by
#> 'rapbaseConfig.yml' will be used as source for user data.
#> [1] "rapporteket@skde.no"
try(getUserEmail(shinySessionObject))
#> System has no defined instance. Configuration as provided by
#> 'rapbaseConfig.yml' will be used as source for user data.
#> [1] "rapporteket@skde.no"
# }