Skip to content

Commit

Permalink
Updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nic-Chr committed Jul 24, 2024
1 parent ecba78f commit d20a585
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 55 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ export(get_hscp_locality)
export(get_simd_datazone)
export(get_simd_postcode)
export(get_spd)
export(have_access)
importFrom(rlang,.data)
importFrom(tibble,tibble)
31 changes: 2 additions & 29 deletions R/access.R
Original file line number Diff line number Diff line change
@@ -1,32 +1,8 @@
#' Check access to lookups
#'
#' @description
#' `have_access()` provides a convenient way to check that you have the
#' correct access to the necessary folders.
#'
#' @returns
#' `[logical(1)]` - `TRUE` if you have appropriate access and `FALSE` otherwise.
#'
#' @examples
#' \dontrun{
#' library(phslookups)
#' if (have_access()) {
#' print("Success!")
#' } else {
#' print("Maybe next time")
#' }
#' }
#' @export
have_access <- function() {
read_access_to_dir(get_lookups_dir())
file.access(get_lookups_dir(), 4) >= 0L
}
check_access <- function(fail_on_no_access = TRUE) {
if (have_access()) {
cli::cli_inform(c("v" = "You have the appropriate file permissions!"),
.frequency = "once",
.frequency_id = "lookup_access_inform"
)
} else {
if (!have_access()) {
no_access_msg <- c(
"x" = "You don't have the appropriate file permissions to {get_lookups_dir()}",

Check warning on line 7 in R/access.R

View workflow job for this annotation

GitHub Actions / lint

file=R/access.R,line=7,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 85 characters.
"i" = "Please raise a ServiceNow request for access to the UNIX acute dataset"

Check warning on line 8 in R/access.R

View workflow job for this annotation

GitHub Actions / lint

file=R/access.R,line=8,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 84 characters.
Expand All @@ -38,6 +14,3 @@ check_access <- function(fail_on_no_access = TRUE) {
}
}
}
read_access_to_dir <- function(path) {
file.access(path, 4) >= 0L
}
25 changes: 0 additions & 25 deletions man/have_access.Rd

This file was deleted.

0 comments on commit d20a585

Please sign in to comment.