MCPcopy Index your code
hub / github.com/nodeSolidServer/node-solid-server / getPossibleACLs

Method getPossibleACLs

lib/acl-checker.mjs:242–258  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

240
241 // Gets all possible ACL paths that apply to the resource
242 getPossibleACLs () {
243 // Obtain the resource URI and the length of its base
244 const { resource: uri, suffix } = this
245 const [{ length: base }] = uri.match(/^[^:]+:\/*[^/]+/)
246
247 // If the URI points to a file, append the file's ACL
248 const possibleAcls = []
249 if (!uri.endsWith('/')) {
250 possibleAcls.push(uri.endsWith(suffix) ? uri : uri + suffix)
251 }
252
253 // Append the ACLs of all parent directories
254 for (let i = lastSlash(uri); i >= base; i = lastSlash(uri, i - 1)) {
255 possibleAcls.push(uri.substr(0, i + 1) + suffix)
256 }
257 return possibleAcls
258 }
259
260 isAcl (resource) {
261 return resource.endsWith(this.suffix)

Callers 2

getNearestACLMethod · 0.95

Calls 1

lastSlashFunction · 0.85

Tested by

no test coverage detected