@@ -107,6 +107,9 @@ test('acl-check accessDenied() test - default/inherited', function (t) {
107
107
let containerAcl = $rdf . sym ( 'https://alice.example.com/docs/.acl' )
108
108
let file1 = $rdf . sym ( 'https://alice.example.com/docs/file1' )
109
109
let file2 = $rdf . sym ( 'https://alice.example.com/docs/stuff/file2' )
110
+ const origin = $rdf . sym ( 'https://apps.example.com' )
111
+ const malorigin = $rdf . sym ( 'https://mallory.example.com' )
112
+ const trustedOrigins = null
110
113
var result
111
114
const store = $rdf . graph ( )
112
115
/*
@@ -125,6 +128,24 @@ test('acl-check accessDenied() test - default/inherited', function (t) {
125
128
$rdf . parse ( containerAclText , store , containerAcl . uri , 'text/turtle' )
126
129
console . log ( '@@' + containerAclText + '@@@' )
127
130
131
+ result = ! aclLogic . accessDenied ( store , file2 , container , containerAcl , alice , [ ACL ( 'Read' ) ] )
132
+ t . ok ( result , 'Alice should have read access - Public' )
133
+
134
+ result = ! aclLogic . accessDenied ( store , file2 , container , containerAcl , bob , [ ACL ( 'Read' ) ] )
135
+ t . ok ( result , 'Bob should have read access too - Public' )
136
+
137
+ result = ! aclLogic . accessDenied ( store , file2 , container , containerAcl , alice , [ ACL ( 'Read' ) ] , origin , trustedOrigins )
138
+ t . ok ( result , 'Alice should have read access regardless of origin - Public' )
139
+
140
+ result = ! aclLogic . accessDenied ( store , file2 , container , containerAcl , bob , [ ACL ( 'Read' ) ] , origin , trustedOrigins )
141
+ t . ok ( result , 'Bob should have read access too regardless of origin - Public' )
142
+
143
+ result = ! aclLogic . accessDenied ( store , file2 , container , containerAcl , alice , [ ACL ( 'Read' ) ] , malorigin , trustedOrigins )
144
+ t . ok ( result , 'Alice should have read access even with wrong origin - Public' )
145
+
146
+ result = ! aclLogic . accessDenied ( store , file2 , container , containerAcl , bob , [ ACL ( 'Read' ) ] , malorigin , trustedOrigins )
147
+ t . ok ( result , 'Bob should have read access too even with wrong origin - Public' )
148
+
128
149
result = aclLogic . accessDenied ( store , file2 , container , containerAcl , alice , [ ACL ( 'Write' ) ] )
129
150
t . ok ( result , 'Alice should NOT have write acces inherited - Public' )
130
151
0 commit comments