Closed Jorge-hercas closed 2 years ago
No you cannot use secure_app()
like that, secure_app()
is intended to be used with the whole application. However you could use auth_ui()
/ auth_server()
module inside a tab, but it will not be as secure as using secure_app()
. An alternative will be to creating roles and creating the tab (or tab's content) only for people with permission.
I am working on a dashboard app, but I would like to know if it is possible for the app to ask for authentication in a specific tab panel. I tried to do something like that but I can't get it to work, do you know if it's possible with shinymanager or with conditionals?
The code im testing is the following:
`if (interactive()) { library(shiny) library(bs4Dash) library(shinymanager)
credentials <- data.frame( user = c("shiny", "shinymanager"), password = c("azerty", "12345"), stringsAsFactors = FALSE )
shinyApp( ui = bs4DashPage( sidebar_collapsed = TRUE, controlbar_collapsed = TRUE, enable_preloader = FALSE, loading_duration = 2, navbar = bs4DashNavbar(skin = "dark"), body = bs4DashBody( bs4TabItems( bs4TabItem( tabName = "tab1", p("xd") ) ) ), sidebar = bs4DashSidebar( skin = "dark", bs4SidebarMenu( id = "test", bs4SidebarMenuItem( tabName = "tab1", text = "Tab 1" ), secure_app(bs4SidebarMenuItem( tabName = "tab2", text = "Tab 2" )), bs4SidebarMenuItem( text = "Click me pleaaaaase", bs4SidebarMenuSubItem( tabName = "subtab1", text = "Tab 3" ),bs4SidebarMenuSubItem( tabName = "subtab2", text = "Tab 4" ) ) ) ), controlbar = bs4DashControlbar(skin = "light"), footer = bs4DashFooter() ), server = function(input, output, session) {
) }`