Set rights and access

One final step when creating/updating packages is to make sure that the rights and access on all the objects that were uploaded are set correctly within the sysmeta. The function arcticdatautils::set_rights_and_access() will set both, and arcticdatautils::set_access() will just set access. There are two functions for this because a rightsHolder should always have access, but not all people who need access are rightsHolders. The rightsHolder of the data package is typically the submitter (if the data set is submitted through the web form (“editor”)), but if a data team member is publishing objects for a PI, the rightsHolder should be the main point of contact for the data set (i.e. the person who requested that we upload the data for them).

To set the rights and access for all of the objects in a package, first get the ORCiD of the person to whom you are giving rights and access. You can set this manually, or grab it from one of the creators in an EML file. You can look up ORCID iDs here

# Manually set ORCiD
 subject <- 'http://orcid.org/PUT-YOUR-ORCD-HERE'

# Set ORCiD from EML creator
# if only 1 creator exists
 subject <- doc$dataset$creator$userId$userId
 # if more than 1 creator exists and you want the first one
 subject <- doc$dataset$creator[[1]]$userId$userId
 
 # As a convention we use `http:` instead of `https:` in our system metadata
 subject <- sub("^https://", "http://", subject)

Note, when setting metadata, the ORCiD must start with http://. ORCiDs in EML should start with https://. The sub() command above will change this formatting for you.

Next, set the rights and access using the following command:

set_rights_and_access(mn, 
                      pids = c(pkg$metadata, pkg$data, pkg$resource_map),
                      subject = subject,
                      permissions = c('read','write','changePermission'))

If you ever need to remove/add public access to your package or object, you can use remove_public_read() or set_public_read(), respectively. Making files publicly readable is especially useful when downloading large amounts of files to the server in order to to use metadata helper functions that require a file path (ex: eml_get_raster_metadata() and get_ncdf4_attributes()).

remove_public_read(mn, c(pkg$metadata, pkg$data, pkg$resource_map))

My profile

The datasets that render under a user’s profile page like here are added if one of the following three System Metadata fields exists. The subject is the rightsHolder or the subject has one of either write or changePermission in the accessPolicy.

If you ever need to remove a subject from the accessPolicy or update the rightsHolder you can use arcticdatautils::remove_access and arcticdatautils::set_rightsHolder, respectively.