Skip to content

Commit f460a8f

Browse files
committed
Failing tests for #15
1 parent 93cad8b commit f460a8f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/unit/access-denied-test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ test('acl-check accessDenied() test - default/inherited', function (t) {
107107
let containerAcl = $rdf.sym('https://alice.example.com/docs/.acl')
108108
let file1 = $rdf.sym('https://alice.example.com/docs/file1')
109109
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
110113
var result
111114
const store = $rdf.graph()
112115
/*
@@ -125,6 +128,24 @@ test('acl-check accessDenied() test - default/inherited', function (t) {
125128
$rdf.parse(containerAclText, store, containerAcl.uri, 'text/turtle')
126129
console.log('@@' + containerAclText + '@@@')
127130

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+
128149
result = aclLogic.accessDenied(store, file2, container, containerAcl, alice, [ ACL('Write')])
129150
t.ok(result, 'Alice should NOT have write acces inherited - Public')
130151

0 commit comments

Comments
 (0)