The add access element creates a list that includes all the required elements for the access section of an EML document. Calling add_access() will output the default public access permissions and cvpia write access permissions. To customize the access level provide values for the allow_principal, add_permission, and cvpia_access arguments.

add_access(
  allow_principal = NULL,
  allow_permission = NULL,
  cvpia_access = TRUE
)

Arguments

allow_principal

The principal argument refers to who will have access to this dataset. The allow_principal argument takes in a string. With no input the allow_principal will default to "public". To change to a different principal please input a new principal.

The valid options for the principal are:

  • 'public' - special principal indicate that any user or group has a particular access permission

  • other individual users or groups can be specified if they are defined in the PASTA EDI authentication system. Read the PASTA documentation for more information https://pastaplus-core.readthedocs.io/_/downloads/en/latest/pdf/

allow_permission

The permission argument refers to the type of access that is allowed to the principal. The allow_permission argument takes in a string. With no input the allow_permission will default to "read". This default permission allows the principal to read the dataset but not edit. To change to a different permission please input a new permission.

The valid options for permission are:

  • 'read' - allow viewing of the resource,

  • 'write' - allow modification of the resource (except for access rules),

  • 'changePermission' - modifications including access rules, and

  • 'all' - all of the above.

cvpia_access

The cvpia_access argument allows for an additional set of permissions for a cvpia user group. The valid options for cvpia_access are:

  • TRUE - default. Gives public "read" access and a CVPIA user group "write" access.

  • FALSE - Inputs for allow_permission and allow_principal are used as the single set of permissions.

Value

Returns an list with all the information required for the access section of an EML document.

Examples

add_access()
#> $scope
#> [1] "document"
#> 
#> $order
#> [1] "allowFirst"
#> 
#> $authSystem
#> [1] "https://pasta.edirepository.org/authentication"
#> 
#> $allow
#> $allow[[1]]
#> $allow[[1]]$principal
#> [1] "public"
#> 
#> $allow[[1]]$permission
#> [1] "read"
#> 
#> 
#> $allow[[2]]
#> $allow[[2]]$principal
#> [1] "cvpia"
#> 
#> $allow[[2]]$permission
#> [1] "write"
#> 
#> 
#> 

add_access(allow_principal = "private",
           allow_permission = "none",
           cvpia_access = FALSE)
#> $scope
#> [1] "document"
#> 
#> $order
#> [1] "allowFirst"
#> 
#> $authSystem
#> [1] "https://pasta.edirepository.org/authentication"
#> 
#> $allow
#> $allow$principal
#> [1] "private"
#> 
#> $allow$permission
#> [1] "none"
#> 
#>