@@ -7,23 +7,36 @@ const $rdf = require('rdflib')
7
7
const ACL = $rdf . Namespace ( 'http://www.w3.org/ns/auth/acl#' )
8
8
const ALICE = $rdf . Namespace ( 'https://alice.example.com/' )
9
9
const alice = ALICE ( '#me' )
10
+ const BOB = $rdf . Namespace ( 'https://bob.example.com/' )
11
+ const bob = BOB ( '#me' )
10
12
11
13
const prefixes = `
12
14
@prefix acl: ${ ACL ( ) } .
13
15
@prefix alice: ${ ALICE ( '#' ) } .
14
16
`
15
17
16
- test ( 'aclCheck getTrustedModesForOrigin() getting trusted modes from agentStore ' , t => {
18
+ test ( 'aclCheck getTrustedModesForOrigin() getting trusted modes from publisherStore ' , t => {
17
19
const origin = $rdf . sym ( 'https://apps.example.com' )
18
- const agent = alice
19
- const agentStore = $rdf . graph ( )
20
- const agentText = `${ prefixes }
21
- ${ agent } acl:trustedApp [ acl:origin ${ origin } ;
20
+ const doc = ALICE ( 'some/doc.txt' )
21
+ const aclDoc = ALICE ( 'some/doc.txt.acl' )
22
+ const publisher = alice
23
+ const requester = bob
24
+ const publisherStore = $rdf . graph ( )
25
+ const aclFileText = `${ prefixes }
26
+ <#owner>
27
+ a acl:Authorization;
28
+ acl:agent ${ publisher } ;
29
+ acl:accessTo ${ doc } ;
30
+ acl:mode acl:Control.
31
+ `
32
+ $rdf . parse ( aclFileText , publisherStore , aclDoc . uri , 'text/turtle' )
33
+ const publisherText = `${ prefixes }
34
+ ${ publisher } acl:trustedApp [ acl:origin ${ origin } ;
22
35
acl:mode acl:Read, acl:Write].
23
36
`
24
- $rdf . parse ( agentText , agentStore , agent . uri , 'text/turtle' )
37
+ $rdf . parse ( publisherText , publisherStore , publisher . uri , 'text/turtle' )
25
38
26
- aclLogic . getTrustedModesForOrigin ( agentStore , agent , origin ) . then ( result => {
39
+ aclLogic . getTrustedModesForOrigin ( publisherStore , aclDoc , doc , origin ) . then ( result => {
27
40
t . deepEqual ( result , [ ACL ( 'Read' ) , ACL ( 'Write' ) ] , 'Should get a list of modes' )
28
41
t . end ( )
29
42
} )
0 commit comments