Skip to content

Latest commit

 

History

History
247 lines (185 loc) · 7.77 KB

aclParser.md

File metadata and controls

247 lines (185 loc) · 7.77 KB

Classes

solidAPI.acl

Class for working with ACL using an aclAgents object

Constants

aclModes

const aclModes = ['Read', 'Append', 'Write', 'Control']

aclAccesses

const aclAccesses = ['accessTo', 'default']

aclPredicates

const aclPredicates = ['agent', 'agentClass', 'agentGroup', 'origin', 'default']

aclObject is a string, aclPredicates related :

  • agent: webId, bot, application, ...
  • agentClass: 'Agent'
  • agentGroup: URI
  • origin: origin url
  • default: '' (blank string)

Functions

aclMode(itemUrl, aclContent, options)

Check if a user or everybody has an auth

checkAcl(itemUrl, aclContent, options)

solidAPI.acl

Class for working with ACL using an aclAgents object

Kind: global class

solidAPI.acl.contentParser(url, aclcontent) ⇒ object | array

aclcontent parser

Kind: instance method of solidAPI.acl
Returns: object | array - aclAgents Object or Array of Objects

Param Type Description
url string resource
aclcontent string of url.acl

solidAPI.acl.createContent(url, aclAgents, options) ⇒ string

create turtle aclcontent for url resource from aclAgents object

Kind: instance method of solidAPI.acl
Returns: string - text/turtle aclContent

Param Type Description
url string ressource (not url.acl)
aclAgents object | array object or Array of objects
options object for isValidAcl()

Properties

Name Type Description
'may' options.aclDefault ('must' is more prudent)
'Control' options.aclMode
if options.URI used check that at least this URI has 'Control'

solidAPI.acl.addUserMode(aclAgents, userAgent, userMode, userAccess) ⇒ object

modify aclAgents object by adding agents and/or modes and/or access types

Kind: instance method of solidAPI.acl
Returns: object - aclAgents

Param Type Description
aclAgents object
userAgent array array of objects { aclPredicate: aclObject }
userMode array ['Read']
userAccess array

Properties

Name Type Description
default userAccess value ['accessTo', 'default']

solidAPI.acl.deleteUserMode(aclAgents, userAgent, userMode, userAccess) ⇒ object

modify aclAgents object by removing agents and/or modes

Kind: instance method of solidAPI.acl
Returns: object - aclAgents

Param Type Description
aclAgents object
userAgent array array of objects { aclPredicate: aclObject }
userMode array ['Read']
userAccess array ['accessTo', 'default']

solidAPI.acl.makeContentRelative(aclcontent, itemUrl, toName, options)

Make aclContent relative to url resource

  • make absolute paths relative to folder
  • make relative paths to pod relative to folder
  • update relative paths to the new location

Kind: instance method of solidAPI.acl

Param Type Description
aclcontent string
itemUrl string resource url (not an url.acl)
toName string destination name ('' or file name)
options object for agent

solidAPI.acl.isValidAcl(itemUrl, content, options)

check that atleast an agent type has control and that the acl is well-formed URI is usually the webId checked to have 'Control' authorization aclDefault: 'may' (spec compliant), if 'must' then one acl: Default is needed for folder ACL aclAuth 'must' : spec compliant acl: Authorization is mandatory

Kind: instance method of solidAPI.acl
Result: object { err: [blocking errors], info: [non blocking anomalies]}

Param Type
itemUrl string
content string
options object

Properties

Name Type
'Control' options.aclMode
'must' options.aclAuth
'may' options.aclDefault

solidAPI.acl.isValidRDF(itemUrl, content, options)

is valid RDF (parses with N3.js)

Kind: instance method of solidAPI.acl

Param Type
itemUrl string
content string
options object

Properties

Name Type Description
default options.baseIRI to itemUrl
none 'text/n3' options.format

aclModes

const aclModes = ['Read', 'Append', 'Write', 'Control']

Kind: global constant

aclAccesses

const aclAccesses = ['accessTo', 'default']

Kind: global constant

aclPredicates

const aclPredicates = ['agent', 'agentClass', 'agentGroup', 'origin', 'default']

aclObject is a string, aclPredicates related :

  • agent: webId, bot, application, ...
  • agentClass: 'Agent'
  • agentGroup: URI
  • origin: origin url
  • default: '' (blank string)

Kind: global constant

aclMode(itemUrl, aclContent, options)

Check if a user or everybody has an auth

Kind: global function

Param Type
itemUrl string
aclContent string
options object

Properties

Name Type Description
'Control' options.aclMode by default
check options.URI for 'Control' for a single URI : person, group, ....

checkAcl(itemUrl, aclContent, options)

Kind: global function

Param Type
itemUrl string
aclContent string
options object