-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sanitize() function, which wipes personal data and adds user URLs (…
…#29) --------- Co-authored-by: Colin Gillespie <colin@jumpingrivers.com>
- Loading branch information
1 parent
c6357e2
commit cd8a282
Showing
9 changed files
with
55 additions
and
8 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
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#' Sanitise {audit.connect} object | ||
#' | ||
#' This function removes user-identifying data from an {audit.connect} object | ||
#' @param audit_connect_check An object from audit.connect::check() | ||
#' @export | ||
sanitise = function(audit_connect_check) { | ||
# Wipe any user-identifiable data | ||
for (value in c("email", "first_name", "last_name", "username")) { | ||
audit_connect_check$users_details$user_list$users[, value] = NA_character_ | ||
} | ||
audit_connect_check | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
describe("Checking sanitize function", { | ||
testthat::skip_on_ci() | ||
# Skip report checks for speed | ||
create_config(default = FALSE, type = "force") | ||
rtn = suppressMessages(check()) | ||
sanitize_rtn = sanitise(rtn) | ||
|
||
it("Check users have been changed", | ||
expect_false(identical(rtn[["users_details"]], | ||
sanitize_rtn[["users_details"]])) | ||
) | ||
|
||
it("Check everything else has stayed the same", { | ||
rtn[["users_details"]] = sanitize_rtn[["users_details"]] = NULL | ||
expect_identical(rtn, sanitize_rtn) | ||
}) | ||
}) |