@solid/acl-check
Web Access Control check access function
Last updated 2 months ago by michielbdejong .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @solid/acl-check 
SYNC missed versions from official npm registry.

acl-check

NPM Version Build Status

Javascript library for checking Web Access Control ACLs.

Usage

const $rdf = require('rdflib')
const aclCheck = require('acl-check')
const ACL = $rdf.Namespace('http://www.w3.org/ns/auth/acl#')

const kb = $rdf.graph()
const fetcher = $rdf.fetcher(kb)

let doc = $rdf.sym('https://alice.example.com/stuff/myVacation.ttl')
let aclDoc = $rdf.sym('https://alice.example.com/stuff/myVacation.ttl.acl')
let directory = $rdf.sym('https://alice.example.com/stuff/')
let dirAclDoc = $rdf.sym('https://alice.example.com/stuff/')

let agent = $rdf.sym('https://alice.example.com/card.ttl#me')
let modesRequired = [ ACL('Read'), ACL('Write'), ACL('Control') ]

await fetcher.load(aclDoc) // Load the ACL documents into kb

let allow = aclCheck.checkAccess(kb, resource, null, aclDoc, agent, modesRequired, origin, trustedOrigins)

// When there is no direct ACL file, find the closest container ACL file in the tree above then...
await fetcher.load(dirAclDoc) // Load the directory ACL documents into kb
let allow = aclCheck.checkAccess(kb, resource, directory, dirAclDoc, agent, modesRequired, origin, trustedOrigins)

console.log('Access allowed? ' + allow)
// OWTTE

Current Tags

  • 0.4.3                                ...           latest (2 months ago)

11 Versions

  • 0.4.3                                ...           2 months ago
  • 0.4.2                                ...           2 months ago
  • 0.4.1                                ...           3 months ago
  • 0.4.0                                ...           3 months ago
  • 0.3.0                                ...           6 months ago
  • 0.2.1                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.1.3                                ...           2 years ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 27
Dependencies (2)
Dev Dependencies (7)

Copyright 2014 - 2016 © taobao.org |