View source: R/database_create.R
gsheet_tables_create | R Documentation |
Create RegLog-valid database tables with googlesheets4
gsheet_tables_create( account_name = "account", reset_code_name = "reset_code", use_log = FALSE, log_name = "logs", user_data = NULL, hash_passwords = FALSE, gsheet_ss = NULL, gsheet_name = NULL, verbose = TRUE )
account_name |
Name of the sheet for storing user accounts credentials. Defaults to 'account'. Mandatory spreadsheet. |
reset_code_name |
Name of the sheet for storing generated password reset codes. Defaults to 'reset_code'. Mandatory table. |
use_log |
Should the sheet for keeping RegLogServer logs be also created? Defaults to FALSE |
log_name |
Name of the sheet for storing logs from RegLogServer object.
Used only if |
user_data |
If you wish to import existing user database, you can input data.frame with that table in this argument. It should contain columns: username, password, email. Defaults to NULL. |
hash_passwords |
If you are importing table of users upon tables creation,
you can also specify if the password should be hashed using |
gsheet_ss |
ID of the googlesheet that you want to append created tables
to. Defaults to |
gsheet_name |
If |
verbose |
Boolean specific if the actions made by function should be
printed back to the console. Defaults to |
Created spreadsheets will have following structure:
account (default name)
username: character
password: character
email: character
create_time: character
update_time: character
reset_code (default name)
user_id: numeric
reset_code: character
used: numeric
create_time: character
update_time: character
logs (default name, optional)
time: character
session: character
direction: character
type: character
note: character
ID of the googlesheet
Other RegLog databases:
DBI_tables_create()
,
mongo_tables_create()
if (googlesheets4::gs4_has_token()) { library(shiny.reglog) # mockup user data user_data <- data.frame(username = c("Whatever", "Hanuka", "Helsinki", "How_come"), password = c("&f5*MSYj^niDt=V'3.[dyEX.C/", "%}&B[fs\\}5PKE@,*+V\\tx9\"at]", "35z*ofW\\'G_8,@vCC`]~?e$Jm%", "s:;r_eLn?-D6;oA-=\"^R(-Ew<x"), email = c("what@mil.com", "hehe@soso.so", "nider@what.no", "crazzz@simpsy.com")) # create the tables and input the data (hashing the passwords in the process) id <- gsheet_tables_create(user_data = user_data, hash_passwords = TRUE, verbose = FALSE) # check generated googlesheet googlesheets4::gs4_get(id) # check the "account" sheet for credentials data googlesheets4::read_sheet(id, "account") # remove example googlesheets googledrive::drive_trash(id) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.