-
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.
Allow unauthenticated users to connect to an instance (#19)
* Allow unauthenticated users to query an instance * refactor connect function * update changelog * rename variables * reduce code duplication * update changelog
- Loading branch information
Showing
6 changed files
with
168 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#' @title UserSettings | ||
#' | ||
#' @noRd | ||
#' | ||
#' @description | ||
#' Settings for a Lamin user. These settings are retrieved from the | ||
#' Lamin Hub API and are used to connect to the user. | ||
UserSettings <- R6::R6Class( # nolint object_name_linter | ||
"UserSettings", | ||
cloneable = FALSE, | ||
public = list( | ||
#' @param settings A named list of settings for the user | ||
initialize = function(settings) { | ||
expected_keys <- c( | ||
"email", | ||
"password", | ||
"access_token", | ||
"api_key", | ||
"uid", | ||
"uuid", | ||
"handle", | ||
"name" | ||
) | ||
missing_column <- setdiff(expected_keys, names(settings)) | ||
if (length(missing_column) > 0) { | ||
cli_abort("Missing column: ", missing_column) | ||
} | ||
unexpected_columns <- setdiff(names(settings), expected_keys) | ||
if (length(unexpected_columns) > 0) { | ||
cli_abort("Unexpected column: ", unexpected_columns) | ||
} | ||
private$.settings <- settings | ||
} | ||
), | ||
private = list( | ||
.settings = NULL | ||
), | ||
active = list( | ||
# Get the email of the user. | ||
email = function() { | ||
private$.settings$email | ||
}, | ||
# Get the password of the user. | ||
password = function() { | ||
private$.settings$password | ||
}, | ||
# Get the access token of the user. | ||
access_token = function() { | ||
private$.settings$access_token | ||
}, | ||
# Get the API key of the user. | ||
api_key = function() { | ||
private$.settings$api_key | ||
}, | ||
# Get the UID of the user. | ||
uid = function() { | ||
private$.settings$uid | ||
}, | ||
# Get the UUID of the user. | ||
uuid = function() { | ||
private$.settings$uuid | ||
}, | ||
# Get the handle of the user. | ||
handle = function() { | ||
private$.settings$handle | ||
}, | ||
# Get the name of the user. | ||
name = function() { | ||
private$.settings$name | ||
} | ||
) | ||
) |
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