Skip to content

Commit

Permalink
import dataone into is_public_read so that we can use dataone:: inste…
Browse files Browse the repository at this point in the history
…ad of dataone:::. Export is_resource_map so it can be used
  • Loading branch information
justinkadi committed Jul 8, 2024
1 parent d76df3f commit 87de791
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/access.R
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ remove_public_read <- function(mn, pids) {
#' @return (logical) Whether an object has public read access.
#'
#' @importFrom httr content
#' @import dataone
#'
#' @export
#'
Expand Down Expand Up @@ -603,10 +604,10 @@ is_public_read <- function(mn, pids, use.names = TRUE) {
vapply(pids, USE.NAMES = use.names, FUN.VALUE = logical(1), FUN = function(pid) {

url <- paste(mn@endpoint, "meta", utils::URLencode(pid, reserved = TRUE), sep = "/")
response <- dataone:::auth_get(url, node = mn)
response <- dataone::auth_get(url, node = mn)

if (response$status_code != "200") {
error_desc <- dataone:::getErrorDescription(response)
error_desc <- dataone::getErrorDescription(response)
if (grepl("READ not allowed", error_desc, ignore.case = TRUE)) {
return(FALSE)
} else {
Expand Down
1 change: 1 addition & 0 deletions R/util.R
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ path_join <- function(path_parts=c("")) {
#' @param pids (character) Vector of PIDs.
#'
#' @return (logical) Whether or not the object(s) are resource maps.
#' @export
#'
#' @noRd
is_resource_map <- function(node, pids) {
Expand Down

0 comments on commit 87de791

Please sign in to comment.