Set the owner and uploader permissions for a project.

setPermissions(
  project,
  registry,
  staging,
  url,
  owners = NULL,
  uploaders = NULL,
  append = TRUE
)

Arguments

project

String containing the project name.

registry

String containing a path to the registry.

staging

String containing the path to the staging directory.

url

String containing the URL of the gobbler REST API.

owners

Character vector containing the user IDs for owners of this project. If NULL, no change is made to the existing owners of the project.

uploaders

List specifying the authorized uploaders for this project. See the uploaders field in the fetchPermissions return value for the expected format. If NULL, no change is made to the existing uploaders of the project.

append

Logical scalar indicating whether owners and uploaders should be appended to the existing owners and uploaders, respectively, of the project. If FALSE, the owners and uploaders are used to replace the existing values.

Value

NULL is invisibly returned upon successful setting of the permissions.

See also

fetchPermissions, to fetch the permissions.

createProject, to set permissions during project creation.

Author

Aaron Lun

Examples

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

# Mocking up an upload. 
src <- allocateUploadDirectory(info$staging)
write(file=file.path(src, "foo"), "BAR")
uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
fetchPermissions("test", registry=info$registry)
#> $owners
#> $owners[[1]]
#> [1] "root"
#> 
#> 
#> $uploaders
#> list()
#> 

# Setting them to something else.
setPermissions("test", 
    owners=c("mum", "dad"), 
    uploaders=list(
        list(id='brother1', asset='ps5', until=Sys.time() + 100000),
        list(id='brother2', asset='harry_potter', version='goblet_of_fire')
    ),
    staging=info$staging,
    url=info$url,
    registry=info$registry
)
fetchPermissions("test", registry=info$registry)
#> $owners
#> $owners[[1]]
#> [1] "root"
#> 
#> $owners[[2]]
#> [1] "mum"
#> 
#> $owners[[3]]
#> [1] "dad"
#> 
#> 
#> $uploaders
#> $uploaders[[1]]
#> $uploaders[[1]]$id
#> [1] "brother1"
#> 
#> $uploaders[[1]]$asset
#> [1] "ps5"
#> 
#> $uploaders[[1]]$until
#> [1] "2024-09-19 19:43:57 UTC"
#> 
#> 
#> $uploaders[[2]]
#> $uploaders[[2]]$id
#> [1] "brother2"
#> 
#> $uploaders[[2]]$asset
#> [1] "harry_potter"
#> 
#> $uploaders[[2]]$version
#> [1] "goblet_of_fire"
#> 
#> 
#>