-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathtypeIndexAclDocuments.ts
More file actions
30 lines (30 loc) · 941 Bytes
/
typeIndexAclDocuments.ts
File metadata and controls
30 lines (30 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
export function publicTypeIndexAclDocument(webId: string, publicTypeIndexUri: string): string {
const fileName = new URL(publicTypeIndexUri).pathname.split('/').pop() || 'publicTypeIndex.ttl'
return [
'# ACL resource for the Public Type Index',
'',
'@prefix acl: <http://www.w3.org/ns/auth/acl#>.',
'@prefix foaf: <http://xmlns.com/foaf/0.1/>.',
'',
'<#owner>',
' a acl:Authorization;',
'',
' acl:agent',
` <${webId}>;`,
'',
` acl:accessTo <./${fileName}>;`,
'',
' acl:mode',
' acl:Read, acl:Write, acl:Control.',
'',
'# Public-readable',
'<#public>',
' a acl:Authorization;',
'',
' acl:agentClass foaf:Agent;',
'',
` acl:accessTo <./${fileName}>;`,
'',
' acl:mode acl:Read.'
].join('\n')
}