isAuthorized {dataone}R Documentation

Check if an action is authorized for the specified identifier

Description

Test if the user identified by the provided token has authorization for operation on the specified object.

Usage

isAuthorized(x, ...)

## S4 method for signature 'D1Node'
isAuthorized(x, id, action)

Arguments

x

The node to send the request to. This is either a "CNode" or "MNode" instance.

...

(Not yet used)

id

The DataONE identifier (pid or sid) to check access for.

action

The DataONE action to check, possible values: "read", "write", "changePermission"

Details

The identifier parameter may be either a DataONE persistent identifier (pid) or series identifier (sid).

Value

a logical, TRUE if the action is authorized, false if not.

See Also

CNode class description.

Examples

## Not run: 
# Send an authorization check to the D1 production CN.
cn <- CNode("PROD")
pid <- "doi:10.6073/pasta/7fcb8fea57843fae65f63094472f502d"
canRead <- isAuthorized(cn, pid, "read")
canWrite <- isAuthorized(cn, pid, "write")
canChange <- isAuthorized(cn, pid, "changePermission")

# Now send a check to a member node.
mn <- getMNode(cn, "urn:node:KNB")
pid <- "doi:10.6085/AA/pisco_recruitment.149.1"
canRead <- isAuthorized(mn, pid, "read")
canWrite <- isAuthorized(mn, pid, "write")
canChange <- isAuthorized(mn, pid, "changePermission")

## End(Not run)

[Package dataone version 2.2.2 Index]