Commit 62d3a5fc authored by khalid's avatar khalid
Browse files

Authentication is disabled if empty login/passwd

parent 3b69a05e
......@@ -8,8 +8,8 @@ library(yaml)
path_yml <- args[1]
output_dir <- args[2]
user <- args[3]
passwd <- args[4]
user <- trimws(args[3], which = "both")
passwd <- trimws(args[4], which = "both")
APP <<- yaml.load_file(path_yml,handlers = list("float#fix"=function(x){ format(x,scientific=F)}))$App
......@@ -870,10 +870,13 @@ generate_app <- function() {
res <- res + ' dashboardHeader(title="'+ main$title + '", titleWidth='+main$menu_width+'),\n\n'
res <- res + ' dashboardSidebar(width='+main$menu_width+', MenuGauche),\n\n'
res <- res + ' dashboardBody(\n\n'
if (passwd != "")
{
res <- res + ' div(class = "pull-right", shinyauthr::logoutUI(id = "logout")), shinyauthr::loginUI(id = "login"),\n\n'
}
res <- res + ' shinyjs::useShinyjs(),\n\n'
res <- res + ' tags$head(tags$link(rel="stylesheet", type="text/css", href="bootstrap.min.readable.css")),\n\n'
res <- res + 'tags$head(style),\n\n'
res <- res + '\ttabItems(\n\n'
......@@ -954,20 +957,22 @@ generate_app <- function() {
res <- res + '\n\n'
res <- res + 'server <- function( input, output, session) {\n\n'
res <- res + ' credentials <- shinyauthr::loginServer( id = "login",data = user_base, user_col = user, pwd_col = password, log_out = reactive(logout_init()) )\n\n'
res <- res + 'logout_init <- shinyauthr::logoutServer( id = "logout",active = reactive(credentials()$user_auth)) \n\n'
res <- res + ' blockDeblock <- function(input_list, enable_inputs=F) {\n\n'
res <- res + ' for(x in setdiff(names(input_list),c("login-user_name","login-password","login-button"))){ \n\n'
res <- res + ' if(enable_inputs){ shinyjs::enable(x)} else { shinyjs::disable(x) } } \n\n'
res <- res + ' if(enable_inputs){shinyjs::enable("unlock"); shinyjs::enable("StopPipeline"); shinyjs::enable("close_session")}\n\n'
res <- res + ' else{shinyjs::disable("unlock"); shinyjs::disable("StopPipeline"); shinyjs::disable("close_session")}\n\n'
res <- res + '}\n\n'
res <- res + 'blockDeblock(isolate(reactiveValuesToList(input)), FALSE)\n\n'
res <- res + 'observeEvent(credentials()$user_auth, {\n\n'
res <- res + 'if (credentials()$user_auth) { blockDeblock(isolate(reactiveValuesToList(input)), TRUE) } else{ blockDeblock(isolate(reactiveValuesToList(input)), FALSE) } }) \n\n'
if (passwd != "")
{
res <- res + ' credentials <- shinyauthr::loginServer( id = "login",data = user_base, user_col = user, pwd_col = password, log_out = reactive(logout_init()) )\n\n'
res <- res + 'logout_init <- shinyauthr::logoutServer( id = "logout",active = reactive(credentials()$user_auth)) \n\n'
res <- res + ' blockDeblock <- function(input_list, enable_inputs=F) {\n\n'
res <- res + ' for(x in setdiff(names(input_list),c("login-user_name","login-password","login-button"))){ \n\n'
res <- res + ' if(enable_inputs){ shinyjs::enable(x)} else { shinyjs::disable(x) } } \n\n'
res <- res + ' if(enable_inputs){shinyjs::enable("unlock"); shinyjs::enable("StopPipeline"); shinyjs::enable("close_session")}\n\n'
res <- res + ' else{shinyjs::disable("unlock"); shinyjs::disable("StopPipeline"); shinyjs::disable("close_session")}\n\n'
res <- res + '}\n\n'
res <- res + 'blockDeblock(isolate(reactiveValuesToList(input)), FALSE)\n\n'
res <- res + 'observeEvent(credentials()$user_auth, {\n\n'
res <- res + 'if (credentials()$user_auth) { blockDeblock(isolate(reactiveValuesToList(input)), TRUE) } else{ blockDeblock(isolate(reactiveValuesToList(input)), FALSE) } }) \n\n'
}
res <- res + '\trv <- reactiveValues(textstream = c(""), running = FALSE, timer = reactiveTimer(1000))\n\n'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment