From 5c5a1a93273baae97dbc5ad1d35d0e52817aa826 Mon Sep 17 00:00:00 2001 From: Robert Baker Date: Fri, 25 Jul 2025 15:07:41 -0600 Subject: [PATCH 1/3] add info about get_user_orcid --- NEWS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS.md b/NEWS.md index 4135283..063330a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,7 @@ # QCkit v1.1.0 +## 2025-07-25 +* add function `get_user_orcid`, which will look up a users orcid using active directory. + ## 2025-05-16 * create_datastore_script now invisibly returns the DataStore reference URL From d80c04f7d0a19f33e202802fa9c74f1f1b3f4266 Mon Sep 17 00:00:00 2001 From: Robert Baker Date: Fri, 25 Jul 2025 15:07:50 -0600 Subject: [PATCH 2/3] add function get_user_orcid --- R/utils.R | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/R/utils.R b/R/utils.R index 225a72c..c44abdb 100644 --- a/R/utils.R +++ b/R/utils.R @@ -69,3 +69,34 @@ get_user_email <- function() { return(email_address) } + +#' Returns the user's ORCID ID from active directory +#' +#' @description +#' This is a function to grab a users ORCID from Active Directory. Requires VPN to access AD. If the user does not have an ORCID, returns "NA". +#' +#' +#' @returns Sting. The user's ORCID ID +#' @export +#' +#' @examples +#' \dontrun{ +#' orcid <- get_user_orcid() +#' } +get_user_orcid <- function() { + powershell_command <- '([adsisearcher]\\"(samaccountname=$env:USERNAME)\\").FindAll().Properties' + + AD_output <- system2("powershell", + args = c("-Command", + powershell_command), + stdout = TRUE) + #get extensionAttribute2 (holds orcid) + orcid <- AD_output[which(AD_output %>% + stringr::str_detect("extensionattribute2"))] + # extract orcid + orcid <- stringr::str_extract(orcid, "\\{.*?\\}") + # remove curly braces: + orcid <- stringr::str_remove_all(orcid, "[{}]") + + return(orcid) +} From 051f2e768816337c961ad268bedef63c380c3be6 Mon Sep 17 00:00:00 2001 From: Robert Baker Date: Fri, 25 Jul 2025 15:08:16 -0600 Subject: [PATCH 3/3] autogenerated by devtools::document and pkgdown::build_site_github_pages --- NAMESPACE | 1 + docs/404.html | 2 +- docs/CONTRIBUTING.html | 2 +- docs/LICENSE-text.html | 2 +- docs/LICENSE.html | 2 +- docs/articles/DRR_Purpose_and_Scope.html | 2 +- docs/articles/Starting-a-DRR.html | 2 +- docs/articles/Using-the-DRR-Template.html | 2 +- docs/articles/index.html | 2 +- docs/authors.html | 2 +- docs/index.html | 2 +- docs/news/index.html | 8 ++++++-- docs/pkgdown.yml | 2 +- docs/reference/DC_col_check.html | 2 +- docs/reference/QCkit-package.html | 2 +- docs/reference/check_dc_cols.html | 2 +- docs/reference/check_te.html | 2 +- docs/reference/convert_datetime_format.html | 2 +- docs/reference/convert_long_to_utm.html | 2 +- docs/reference/convert_utm_to_ll.html | 2 +- docs/reference/create_datastore_script.html | 6 +++--- docs/reference/document_missing_values.html | 6 +++--- docs/reference/fix_utc_offset.html | 2 +- docs/reference/fuzz_location.html | 2 +- docs/reference/generate_ll_from_utm.html | 2 +- docs/reference/get_custom_flags.html | 4 ++-- docs/reference/get_dc_flags.html | 4 ++-- docs/reference/get_df_flags.html | 4 ++-- docs/reference/get_dp_flags.html | 4 ++-- docs/reference/get_elevation.html | 2 +- docs/reference/get_park_polygon.html | 2 +- docs/reference/get_taxon_rank.html | 2 +- docs/reference/get_utm_zone.html | 2 +- docs/reference/index.html | 8 +++++++- docs/reference/long2UTM.html | 2 +- docs/reference/order_cols.html | 2 +- docs/reference/remove_empty_tables.html | 2 +- docs/reference/replace_blanks.html | 6 +++--- docs/reference/te_check.html | 2 +- docs/reference/unit_codes_to_names.html | 2 +- docs/reference/utm_to_ll.html | 2 +- docs/reference/validate_coord.html | 2 +- docs/reference/validate_coord_list.html | 2 +- docs/sitemap.xml | 1 + man/get_user_orcid.Rd | 19 +++++++++++++++++++ 45 files changed, 84 insertions(+), 53 deletions(-) create mode 100644 man/get_user_orcid.Rd diff --git a/NAMESPACE b/NAMESPACE index 11c6f12..6b72a29 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -18,6 +18,7 @@ export(get_dp_flags) export(get_elevation) export(get_park_polygon) export(get_taxon_rank) +export(get_user_orcid) export(get_utm_zone) export(long2UTM) export(order_cols) diff --git a/docs/404.html b/docs/404.html index 50285fd..d6e5d18 100644 --- a/docs/404.html +++ b/docs/404.html @@ -20,7 +20,7 @@ QCkit - 1.0.2 + 1.1.0