From 4b5984afc2863b884c80fbb82bd140c8a920d16f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20Escrib=C3=A0=20Montagut?= Date: Thu, 16 May 2024 10:56:08 +0200 Subject: [PATCH] feat: aux function to check if user in DB --- components/modules/AuthenticationModule_functions.R | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/components/modules/AuthenticationModule_functions.R b/components/modules/AuthenticationModule_functions.R index 3d5c69940..f8003537c 100644 --- a/components/modules/AuthenticationModule_functions.R +++ b/components/modules/AuthenticationModule_functions.R @@ -14,6 +14,19 @@ create_user_dir_if_needed <- function(user_dir, pgxdir) { } } +check_user_options_db <- function(email, user_database = NULL) { + if (is.null(user_database)) { + return(FALSE) + } + connection <- connect_db(user_database) + user_opt <- query_by_email(email, connection) + if(is.null(user_opt)) { + return(FALSE) # user NOT in db + } else { + return(TRUE) # user IN db + } +} + read_user_options <- function(user_dir) { user_opt_file <- file.path(user_dir, "OPTIONS") new_opt <- opt ## opt from global