-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from acornamr/dev
v2.6.1
- Loading branch information
Showing
6 changed files
with
58 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
.Ruserdata | ||
*.DS_Store | ||
*.dcf | ||
.Renviron |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,41 @@ | ||
creds <- readxl::read_excel("/Users/olivier/Documents/Projets/ACORN/Data/ACORN2_cred.xlsx", | ||
sheet = "cred") |> | ||
filter(!is.na(site)) | ||
# INSTRUCTIONS: | ||
# - use the R commands below to generate one .rds file per line in ACORN2_cred.xlsx | ||
# - add encrypted_cred_XXX_YYY.rds to the S3 "shared-acornamr" folder | ||
# - rename encrypted_cred_demo.rds into encrypted_cred_demo_demo.rds | ||
# - add encrypted_cred_demo.rds to the app "www/cred" folder | ||
|
||
dir <- "/Users/olivier/Documents/Consultances/ACORN/Data" | ||
|
||
creds <- readxl::read_excel( | ||
path = glue::glue("{dir}/ACORN2_cred.xlsx"), | ||
sheet = "cred") |> | ||
dplyr::filter( | ||
!is.na(site) | ||
) | ||
|
||
|
||
for (i in 1:nrow(creds)) { | ||
user <- creds[i, ] | ||
|
||
cred <- serialize( | ||
object = list(site = user$site, | ||
user = user$user, | ||
# REDCap | ||
redcap_access = user$redcap_access, | ||
redcap_uri = user$redcap_uri, | ||
redcap_f01f05_api = user$redcap_f01f05_api, | ||
redcap_hai_api = user$redcap_hai_api, | ||
# AWS S3 | ||
aws_access = user$aws_access, | ||
aws_bucket = user$aws_bucket, | ||
aws_region = user$aws_region, | ||
aws_key = user$aws_key, | ||
aws_secret = user$aws_secret | ||
object = list( | ||
site = user$site, | ||
user = user$user, | ||
# REDCap | ||
redcap_access = user$redcap_access, | ||
redcap_uri = user$redcap_uri, | ||
redcap_f01f05_api = user$redcap_f01f05_api, | ||
redcap_hai_api = user$redcap_hai_api, | ||
# AWS S3 | ||
aws_access = user$aws_access, | ||
aws_bucket = user$aws_bucket, | ||
aws_region = user$aws_region, | ||
aws_key = user$aws_key, | ||
aws_secret = user$aws_secret | ||
), | ||
connection = NULL) | ||
|
||
encrypted_cred <- openssl::aes_cbc_encrypt(cred, key = openssl::sha256(charToRaw(user$pwd))) | ||
saveRDS(encrypted_cred, glue::glue("/Users/olivier/Documents/Projets/ACORN/Data/ACORN2_creds/encrypted_cred_{user$site}_{user$user}.rds")) | ||
saveRDS(encrypted_cred, glue::glue("{dir}/ACORN2_creds/encrypted_cred_{user$site}_{user$user}.rds")) | ||
} | ||
|
||
# Instructions: | ||
# encrypted_cred_XXX_YYY.rds files should be added to the "shared-acornamr" folder | ||
# "encrypted_cred_demo.rds" should be added to the "www/cred" folder. | ||
# "shared_acornamr_key.rds" and "share-acornamr_sec.rds" should be added to the "www/cred" folder. | ||
# They can be generated with the commands: | ||
# saveRDS("COPY_KEY_HERE", file = "/Users/olivier/Documents/Projets/ACORN/Data/ACORN2_creds/shared_acornamr_key.rds") | ||
# saveRDS("COPY_SECRET_HERE", file = "/Users/olivier/Documents/Projets/ACORN/Data/ACORN2_creds/shared_acornamr_sec.rds") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters