isAuthorized: Check if an action is authorized for the specified identifier

Description Usage Arguments Details Value See Also Examples

Description

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

Usage

1
2
3
4
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## 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)

dataone documentation built on July 2, 2018, 1:02 a.m.