Skip to content

Commit 1831f69

Browse files
Use ACL_LINK constant from solid-logic
1 parent 6e2c149 commit 1831f69

6 files changed

Lines changed: 21 additions & 10 deletions

File tree

package-lock.json

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"path-browserify": "^1.0.1",
6464
"rdflib": "^2.1.1",
6565
"solid-auth-client": "^2.5.2",
66+
"solid-logic": "^1.0.2",
6667
"solid-namespace": "^0.5.0",
6768
"stream-browserify": "^3.0.0",
6869
"uuid": "^8.3.1"

src/acl/acl.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { AgentMapMap, AgentMapUnion, ComboList } from './types'
1212
import * as debug from '../debug'
1313
import { graph, IndexedFormula, NamedNode, serialize, st, sym } from 'rdflib'
1414
import { LiveStore } from 'pane-registry'
15+
import { ACL_LINK } from 'solid-logic'
1516

1617
/**
1718
* Take the "default" ACL and convert it into the equivlent ACL
@@ -414,7 +415,7 @@ export function setACL (
414415
): void {
415416
const aclDoc = kb.any(
416417
kb.sym(docURI),
417-
kb.sym('http://www.iana.org/assignments/link-relations/acl')
418+
kb.sym(ACL_LINK)
418419
) // @@ check that this get set by web.js
419420
if (aclDoc) {
420421
// Great we already know where it is
@@ -429,7 +430,7 @@ export function setACL (
429430
if (!ok) return callbackFunction(ok, 'Gettting headers for ACL: ' + body)
430431
const aclDoc = kb.any(
431432
kb.sym(docURI),
432-
kb.sym('http://www.iana.org/assignments/link-relations/acl')
433+
kb.sym(ACL_LINK)
433434
) // @@ check that this get set by web.js
434435
if (!aclDoc) {
435436
// complainIfBad(false, "No Link rel=ACL header for " + docURI)
@@ -582,7 +583,7 @@ export function getACL (
582583
}
583584
const aclDoc = kb.any(
584585
doc,
585-
kb.sym('http://www.iana.org/assignments/link-relations/acl')
586+
kb.sym(ACL_LINK)
586587
) // @@ check that this get set by web.js
587588
if (!aclDoc) {
588589
callbackFunction(false, 900, `No Link rel=ACL header for ${doc}`)

src/authn/authn.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,18 @@
1919
* * `statusArea` A DOM element (opt) progress stuff can be displayed, or error messages
2020
* @packageDocumentation
2121
*/
22+
import { graph, namedNode, NamedNode, Namespace, serialize, st, Statement, sym, UpdateManager } from 'rdflib'
23+
import solidAuthClient from 'solid-auth-client'
24+
import { ACL_LINK } from 'solid-logic'
25+
import { PaneDefinition } from 'pane-registry'
2226
import Signup from './signup'
2327
import widgets from '../widgets'
24-
import solidAuthClient from 'solid-auth-client'
2528
import ns from '../ns.js'
2629
import kb from '../store.js'
2730
import utils from '../utils.js'
2831
import { alert } from '../log'
2932
import { AppDetails, AuthenticationContext } from './types'
30-
import { PaneDefinition } from 'pane-registry'
3133
import * as debug from '../debug'
32-
import { graph, namedNode, NamedNode, Namespace, serialize, st, Statement, sym, UpdateManager } from 'rdflib'
3334
import { textInputStyle, buttonStyle, commentStyle } from '../style'
3435
// eslint-disable-next-line camelcase
3536
import { Quad_Object } from 'rdflib/lib/tf-types'
@@ -756,7 +757,7 @@ export function setACLUserPublic (
756757
): Promise<NamedNode> {
757758
const aclDoc = kb.any(
758759
kb.sym(docURI),
759-
kb.sym('http://www.iana.org/assignments/link-relations/acl')
760+
kb.sym(ACL_LINK)
760761
)
761762

762763
return Promise.resolve()
@@ -801,7 +802,7 @@ function fetchACLRel (docURI: string): Promise<NamedNode> {
801802

802803
const aclDoc = kb.any(
803804
kb.sym(docURI),
804-
kb.sym('http://www.iana.org/assignments/link-relations/acl')
805+
kb.sym(ACL_LINK)
805806
)
806807

807808
if (!aclDoc) {

test/unit/acl/acl.mocks.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export const DEFAULT_CONTAINER_ACL = sym('https://example.com/doc.ttl.acl')
88
export const DEFAULT_RESOURCE_DOC = sym('https://example.com/')
99
export const DEFAULT_RESOURCE_ACL = sym('https://example.com/.acl')
1010
export const PROFILE = sym('https://example.com/profile/card#me')
11-
export const ACL_LINK = sym('http://www.iana.org/assignments/link-relations/acl')
1211

1312
export const mocks = {
1413
aclWithAllAgents: getFileContent(resolve(__dirname, './mocks/aclWithAllAgents.ttl')),

test/unit/acl/acl.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ACL_LINK } from 'solid-logic'
12
import { silenceDebugMessages } from '../../helpers/setup'
23
import {
34
ACLbyCombination,
@@ -25,7 +26,6 @@ import { createLiveStore } from '../helpers/createLiveStore'
2526
import { clearStore } from '../helpers/clearStore'
2627
import globalStore from '../../../src/store'
2728
import {
28-
ACL_LINK,
2929
DEFAULT_CONTAINER_ACL,
3030
DEFAULT_CONTAINER_DOC,
3131
DEFAULT_RESOURCE_ACL,

0 commit comments

Comments
 (0)