wchmod
v0.0.2
Published
chmod for Solid Web Access Control — manage .acl files from the command line
Maintainers
Readme
wchmod
chmod for Solid Web Access Control — manage .acl files from the command line.
Install
npm install -g wchmodOr use directly with npx:
npx wchmod +r public ./resourceUsage
# Grant permissions
wchmod +r public ./blog/post.ttl # public read
wchmod +rw https://alice.pod/card#me ./f # agent read+write
wchmod +a authenticated ./inbox/ # authenticated append
wchmod +c https://bob.pod/card#me ./data # agent control
# Revoke permissions
wchmod -w public ./data/ # remove public write
wchmod -r https://alice.pod/card#me ./f # remove agent read
# List current ACL
wchmod ls ./blog/post.ttl
# Create initial .acl
wchmod init --owner https://alice.pod/card#me ./blog/Modes
| Letter | ACL Mode | HTTP Methods |
|--------|----------|-------------|
| r | acl:Read | GET, HEAD |
| w | acl:Write | PUT, POST, PATCH, DELETE |
| a | acl:Append | POST, INSERT-only PATCH |
| c | acl:Control | Manage the .acl file |
Agents
| Shorthand | Meaning |
|-----------|---------|
| public | Everyone (no auth required) |
| authenticated | Any authenticated user |
| https://... | Specific WebID |
| group:https://... | Agent group URI |
Options
| Flag | Description |
|------|-------------|
| --default, -d | Also set acl:default (container inheritance) |
| --force, -f | Overwrite existing .acl (for init) |
| --dry-run, -n | Show what would change without writing |
| --quiet, -q | Suppress non-error output |
Library API
import { readAcl, writeAcl, initAcl, parseAcl, serializeAcl,
formatAcl, resolveMode, resolveAgent, AclDoc } from 'wchmod'
// Read an ACL
const { doc, aclPath } = await readAcl('./resource')
// Grant public read
doc.grant(
resolveAgent('public'),
resolveMode('r'),
'./resource'
)
// Write back
await writeAcl('./resource', doc)
// Parse Turtle directly
const doc2 = parseAcl(turtleString)
const turtle = serializeAcl(doc2)Specification
License
AGPL-3.0
