Skip to content

Commit

Permalink
Use the latest version of connectapi (#35)
Browse files Browse the repository at this point in the history
* Use the latest version of connectapi

* fix: #15
  • Loading branch information
csgillespie authored Jun 10, 2024
1 parent 116a59f commit c7e4155
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 17 deletions.
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Type: Package
Package: audit.connect
Title: Posit Connect Health Check
Version: 0.7.4
Version: 0.7.5
Authors@R:
person("Jumping", "Rivers", , "[email protected]", role = c("aut", "cre"))
Description: Posit Connect Health Check. Deploys various content types to
assess whether Connect is functioning correctly.
License: file LICENSE
Imports:
audit.base (>= 0.6.10),
audit.base (>= 0.6.15),
cli,
connectapi (>= 0.1.3.1),
connectapi (>= 0.2.0),
dplyr,
fs,
httr,
Expand All @@ -21,7 +21,7 @@ Imports:
purrr,
quarto (>= 1.3),
rlang,
rsconnect (>= 1.1.0),
rsconnect (>= 1.3.1),
stringr,
tibble
Suggests:
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# audit.connect 0.7.5 _2024-06-10_
- fix: Use latest version of {connactapi}
- chore: Fix Rd warnings due to R4.4
- fix: #15

# audit.connect 0.7.4 _2024-04-04_
- feat: Force `server` to have `http(?s)`
- feat: Improved error message when testing status response
Expand Down
2 changes: 1 addition & 1 deletion R/check.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' This functions runs all Posit tests.
#' To skip tests, set check to `no` in the config yaml file.
#' See `create_config()`
#' @param server Connect server. If NULL, use the ENV variable CONNECT_SERVER
#' @param server Connect server (URL). If NULL, use the ENV variable CONNECT_SERVER.
#' @param token Connect api token. If NULL, use the ENV variable CONNECT_API_KEY
#' @param dir directory location of the the config file
#' @param debug_level Integer, 0 to 2.
Expand Down
2 changes: 1 addition & 1 deletion R/sanitise.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Sanitise {audit.connect} object
#'
#' This function removes user-identifying data from an {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) {
Expand Down
25 changes: 16 additions & 9 deletions R/summarise_users.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,20 @@ print_audit_users = function(user_list) {

print_audit_user_apps = function(client, debug_level) {
suppress = get_suppress(debug_level)
apps = suppress(connectapi::cache_apps(client))
# Remove any api keys; don't need or want them
apps = purrr::map(apps, ~{.x$EnvironmentJson = NULL; .x}) # nolint
app_creators = purrr::map_df(apps,
~dplyr::tibble(owner = .x[["owner_username"]],
locked = .x$owner_locked))
locked_users = dplyr::filter(app_creators, .data$locked) # nolint: object_usage_linter
cli::cli_alert_info("{nrow(locked_users)} applications owned by locked users")
apps
content = suppress(connectapi::get_content(client))
locked_users = suppress(connectapi::get_users(client)) |>
dplyr::filter(.data$locked)
locked_content = dplyr::inner_join(content, locked_users,
by = dplyr::join_by(owner_guid == guid)) |>
dplyr::group_by(username) |>
dplyr::summarise(n = dplyr::n()) |>
dplyr::arrange(dplyr::desc(n))

cli::cli_alert_info("{sum(locked_content$n)} applications owned by locked users")

for (i in seq_len(nrow(locked_content))) {
row = locked_content[i, ]
cli::cli_alert_info("{row$n} locked application{?s} owned by {cli::style_italic(row$username)}")
}
content
}
2 changes: 1 addition & 1 deletion man/check.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/sanitise.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c7e4155

Please sign in to comment.