My application server file looks like this :
packages <- c("shiny", "shinydashboard", "RColorBrewer", "DT", "readxl", "plotly", "shinyanimate", "tidyverse", "shinycssloaders", "gridExtra", "shinyjs", "shinymanager")
lapply(packages, library, character.only = TRUE)
credentials <- data.frame(
user = c("A", "B", "C"),
password = c("Admin", "User1", "User2"),
admin = c(TRUE, FALSE, FALSE),
permission = c("advanced", "basic", "basic"),
job = c("CEO", "CTO", "DRH"),
stringsAsFactors = FALSE)
server <- function(input, output, session) {
res_auth <- secure_server(
check_credentials = check_credentials(credentials)
)
# Create reactive values including all credentials
creds_reactive <- reactive({
reactiveValuesToList(res_auth)
})
observeEvent(creds_reactive()$job, {
data <- subset(data,
grepl(creds_reactive()$job,
ignore.case = TRUE,
Job))
output$ev <- renderUI ({
data <- subset(data,
grepl(creds_reactive()$job,
ignore.case = TRUE,
Job))
tags$iframe(
seamless = "seamless",
src = "link to the second application",
style = "overflow:hiden; overflow-x : hidden; overflow-y : hidden; height:90%; width : 125%; position : absolute; top : 50px; padding : 0;",
height = "200%", width = "100%",#"100%", #2000, #transform = scale(10),
#"transform-origin" = "top right",
frameBorder = "0"
)})
})
}
I would like to apply a filter on my second application in the iframe.
For example if A connects, data in my second app will show only rows for CEO, if B connects, data in my second app will show only rows for CTO .....
My question is if there is a possibility to apply this filter to an external application?
I thank you in advance for your answers and for your time :).
The following script creates two shiny apps: The
child_app
is running in a seperate background R process (depending on how you deploy your app this might not be needed), which can be controlled (filtered) via query strings.The
parent_app
displays thechild_app
in aniframe
and changes the query string (iframe
'ssrc
) depending on the user accessing the app (permission level):Please note the
Species
column:Edit: Here is a clean multi-file approach avoiding nested render-functions (This needs to be adapted when used with shiny-server - please see my comments):
child_app.R:
parent_app.R: