Skip to content

Commit b38c31b

Browse files
committed
The package now contains config(), sign_in() and sign_out() only.
1 parent 97f6723 commit b38c31b

File tree

9 files changed

+91
-69
lines changed

9 files changed

+91
-69
lines changed

DESCRIPTION

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
Package: BioDataScience
22
Type: Package
33
Version: 2020.0.0
4-
Title: A Series of Learnr Documents for Biological Data Science
5-
Description: Interactive documents using learnr for studying biological data science.
4+
Title: Configuration for Biological Data Science Course
5+
Description: User sign in and sign out for the course.
66
Authors@R: c(
77
person("Philippe", "Grosjean", role = c("aut", "cre"),
88
email = "phgrosjean@sciviews.org"),
99
person("Guyliann", "Engels", role = "aut",
1010
email = "guyliann.engels@umons.ac.be"))
1111
Maintainer: Philippe Grosjean <phgrosjean@sciviews.org>
1212
Depends: R (>= 3.3.0)
13+
Imports: learndown
1314
Suggests: covr, knitr, testthat
1415
License: MIT + file LICENSE
1516
Encoding: UTF-8

NAMESPACE

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# Generated by roxygen2: do not edit by hand
22

3-
export(init)
3+
export(config)
4+
export(sign_in)
5+
export(sign_out)

NEWS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
- Clean up finished. Most code moved to learndown. Learnr tutorials and Shiny
44
applications moved to BioDataScience1.
5+
- The package now contains `config()`, `sign_in()` and `sign_out()` only for
6+
database access and user identification.
57

68
# BioDataScience 2020.0.9002
79

8-
- Add `MONGO_URL_SERVER` environmlent variable in `init()`.
10+
- Add `MONGO_URL_SERVER` environment variable in `init()`.
911

1012
# BioDataScience 2020.0.9001
1113

R/BioDataScience-package.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
#' Base configuration for BioDataScience
1+
#' Base configuration functions for BioDataScience
22
#'
3-
#' Configure the R environment for the BioDartaScience course using [init()].
3+
#' Record user informations using [sign_in()] (or erase them using [sign_out()]).
4+
#' Access the MongoDB database for the course through [config()].
45
#'
56
#' @docType package
67
#' @name BioDataScience-package

R/config.R

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#' Configure the R environment to access my MongoDB database, and provide or
2+
#' cache user information for reuse in learnr and shiny applications that are
3+
#' run locally.
4+
#'
5+
#' Environment variables are added with infos about my database and files
6+
#' are written in the user's directory with cache data.
7+
#'
8+
#' @param data Fingerprint data (user information) either in clear, or ciphered. In
9+
#' this case, the string must start with "fingerprint=".
10+
#' @param debug Do we issue debugging messages (by default, yes if the
11+
#' environment variables `LEARNDOWN_DEBUG` is not `0`).
12+
#'
13+
#' @return `TRUE` or `FALSE` invisibly, if it succeeds or not (with database
14+
#' access test).
15+
#' @export
16+
config <- function(debug = Sys.getenv("LEARNDOWN_DEBUG", 0) != 0) {
17+
learndown::config(
18+
url = "https://wp.sciviews.org/biodatascience_config",
19+
password = .pass_conf,
20+
cache = "~/.biodatascience_config",
21+
debug = debug)
22+
}
23+
24+
#' @rdname config
25+
#' @export
26+
sign_in <- function(data, debug = Sys.getenv("LEARNDOWN_DEBUG", 0) != 0) {
27+
learndown::sign_in(data = data,
28+
password = .pass_user, iv = .iv_user,
29+
cache = "~/.biodatascience_user",
30+
debug = debug)
31+
}
32+
33+
#' @rdname config
34+
#' @export
35+
sign_out <- function(debug = Sys.getenv("LEARNDOWN_DEBUG", 0) != 0) {
36+
learndown::sign_out(title = "D\u00e9senregistement",
37+
message = "Confirmez-vous que vous voulez vous d\u00e9senregistrer (votre activit\u00e9 dans les tutoriels learnr et les applications Shiny ne sera plus enregistr\u00e9e) ?",
38+
cache = "~/.biodatascience_user",
39+
debug = debug)
40+
}
41+
42+
# These items should better be hidden... but how?
43+
.pass_conf <- "$G8rLCuk4D7g!G%!kH@BzzvWKpa&LT6d"
44+
.pass_user <- "R*.px_#:4hVXZ#d#&,0fU52lEzc6.,Qv"
45+
.iv_user <- "1638369746832634"

R/init.R

Lines changed: 0 additions & 35 deletions
This file was deleted.

man/BioDataScience-package.Rd

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/config.Rd

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/init.Rd

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)