Javascript library for checking Web Access Control ACLs.
const$rdf=require('rdflib')constaclCheck=require('acl-check')constACL=$rdf.Namespace('http://www.w3.org/ns/auth/acl#')constkb=$rdf.graph()constfetcher=$rdf.fetcher(kb)letdoc=$rdf.sym('https://alice.example.com/stuff/myVacation.ttl')letaclDoc=$rdf.sym('https://alice.example.com/stuff/myVacation.ttl.acl')letdirectory=$rdf.sym('https://alice.example.com/stuff/')letdirAclDoc=$rdf.sym('https://alice.example.com/stuff/')letagent=$rdf.sym('https://alice.example.com/card.ttl#me')letmodesRequired=[ACL('Read'),ACL('Write'),ACL('Control')]awaitfetcher.load(aclDoc)// Load the ACL documents into kbletallow=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...awaitfetcher.load(dirAclDoc)// Load the directory ACL documents into kbletallow=aclCheck.checkAccess(kb,resource,directory,dirAclDoc,agent,modesRequired,origin,trustedOrigins)console.log('Access allowed? '+allow)// OWTTE