Fetch the permissions for a project. This will call the REST API if the caller is not on the same filesystem as the registry.

fetchPermissions(project, registry, url, forceRemote = FALSE)

Arguments

project

String containing the project name.

registry

String containing a path to the registry.

url

String containing the URL to the Gobbler REST API. Only used for remote access.

forceRemote

Logical scalar indicating whether to force remote access via the API, even if registry is on the same filesystem as the caller.

Value

List containing the permissions for this project. This has the following elements:

  • owners, a character vector containing the user IDs of owners of this project.

  • uploaders, a list of lists specifying the users or organizations who are authorzied to upload to this project. Each entry is a list with the following fields:

    • id, a string containing a user ID that is authorized to upload.

    • (optional) asset, a string containing the name of the asset that the uploader is allowed to upload to. If not provided, there is no restriction on the uploaded asset name.

    • (optional) version, a string containing the name of the version that the uploader is allowed to upload to. If not provided, there is no restriction on the uploaded version name.

    • (optional) until, a POSIXct object containing the expiry date of this authorization. If not provided, the authorization does not expire.

    • (optional) trusted, whether the uploader is trusted. If not provided, defaults to FALSE.

See also

setPermissions, to set the permissions.

Author

Aaron Lun

Examples

info <- startGobbler()
removeProject("test", info$staging, url=info$url) # start with a clean slate.

# Mocking up a project.upload. 
createProject("test", info$staging, url=info$url,
    uploaders=list(list(id="urmom", until=Sys.time() + 1000)))

# Fetching the permissions.
fetchPermissions("test", registry=info$registry, url=info$url)
#> $owners
#> $owners[[1]]
#> [1] "root"
#> 
#> 
#> $uploaders
#> $uploaders[[1]]
#> $uploaders[[1]]$id
#> [1] "urmom"
#> 
#> $uploaders[[1]]$until
#> [1] "2024-09-18 16:13:49 UTC"
#> 
#> 
#> 

# Forcing remote access.
fetchPermissions("test", registry=info$registry, url=info$url, forceRemote=TRUE)
#> $owners
#> $owners[[1]]
#> [1] "root"
#> 
#> 
#> $uploaders
#> $uploaders[[1]]
#> $uploaders[[1]]$id
#> [1] "urmom"
#> 
#> $uploaders[[1]]$until
#> [1] "2024-09-18 16:13:49 UTC"
#> 
#> 
#>