@@ -15,7 +15,7 @@ const prefixes = `
15
15
@prefix alice: ${ ALICE ( '#' ) } .
16
16
`
17
17
18
- test ( 'aclCheck getTrustedModesForOrigin() getting trusted modes from publisherStore' , t => {
18
+ test ( 'aclCheck getTrustedModesForOrigin() getting trusted modes from publisherStore (acl:accessTo on resource) ' , t => {
19
19
const origin = $rdf . sym ( 'https://apps.example.com' )
20
20
const doc = ALICE ( 'some/doc.txt' )
21
21
const aclDoc = ALICE ( 'some/doc.txt.acl' )
@@ -36,7 +36,35 @@ test('aclCheck getTrustedModesForOrigin() getting trusted modes from publisherSt
36
36
`
37
37
$rdf . parse ( publisherText , publisherStore , publisher . uri , 'text/turtle' )
38
38
39
- aclLogic . getTrustedModesForOrigin ( publisherStore , aclDoc , doc , origin , Promise . resolve . bind ( Promise ) ) . then ( result => {
39
+ aclLogic . getTrustedModesForOrigin ( publisherStore , doc , null , aclDoc , origin , Promise . resolve . bind ( Promise ) ) . then ( result => {
40
+ t . deepEqual ( result , [ ACL ( 'Read' ) , ACL ( 'Write' ) ] , 'Should get a list of modes' )
41
+ t . end ( )
42
+ } )
43
+ } )
44
+
45
+ test ( 'aclCheck getTrustedModesForOrigin() getting trusted modes from publisherStore (acl:accessTo on container)' , t => {
46
+ const origin = $rdf . sym ( 'https://apps.example.com' )
47
+ const container = ALICE ( 'some/' )
48
+ const doc = ALICE ( 'some/doc.txt' )
49
+ const aclDoc = ALICE ( 'some/doc.txt.acl' )
50
+ const publisher = alice
51
+ const requester = bob
52
+ const publisherStore = $rdf . graph ( )
53
+ const aclFileText = `${ prefixes }
54
+ <#owner>
55
+ a acl:Authorization;
56
+ acl:agent ${ publisher } ;
57
+ acl:default ${ container } ;
58
+ acl:mode acl:Control.
59
+ `
60
+ $rdf . parse ( aclFileText , publisherStore , aclDoc . uri , 'text/turtle' )
61
+ const publisherText = `${ prefixes }
62
+ ${ publisher } acl:trustedApp [ acl:origin ${ origin } ;
63
+ acl:mode acl:Read, acl:Write].
64
+ `
65
+ $rdf . parse ( publisherText , publisherStore , publisher . uri , 'text/turtle' )
66
+
67
+ aclLogic . getTrustedModesForOrigin ( publisherStore , doc , container , aclDoc , origin , Promise . resolve . bind ( Promise ) ) . then ( result => {
40
68
t . deepEqual ( result , [ ACL ( 'Read' ) , ACL ( 'Write' ) ] , 'Should get a list of modes' )
41
69
t . end ( )
42
70
} )
0 commit comments