crunchyPublicBody: Alternate UIs for unauthenticated and unauthorized users

Description Usage Arguments Value See Also Examples

Description

crunchyServer() and crunchyBody() allow you to protect your app with Crunch authentication and authorization. Add these UI contents to your shiny::shinyUI() body to display different content for visitors who are not authenticated with Crunch (crunchyPublicBody()) or who are authenticated but not authorized to access your app (crunchyUnauthorizedBody).

Usage

1
2
3

Arguments

...

UI elements for your app, to be conditionally rendered

Value

An empty string; these functions are called for their side effects of registering the UI elements so that crunchyServer() can render them as appropriate.

See Also

crunchyBody(); setCrunchyAuthorization() for governing who is authorized to view your app.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Not run: 
# This is the example from crunchyBody(), adding these alternate bodies:
shinyUI(fluidPage(
    tags$head(
        # This is content that will always be rendered
        tags$title("My secure app")
    ),
    crunchyBody(
        # This is content that only is rendered if the user is authorized
        fluidRow(
            column(6, h1("Column 1")),
            column(6, h1("Column 2"))
        )
    ),
    crunchyPublicBody(
        # This is shown to visitors who are not logged into Crunch at all
        h1("Please log into Crunch.")
    ),
    crunchyUnauthorizedBody(
        # This is for Crunch users who don't meet your authorization criteria
        # Perhaps they don't have access to a particular dataset
        h1("You don't have access to this app."),
        tags$div("Contact your_admin@example.com.")
    )
))

## End(Not run)

crunchy documentation built on Jan. 16, 2021, 5:17 p.m.