()
| 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) |
no test coverage detected