(file, req, res, callback)
| 239 | |
| 240 | // TODO: get rid of this ugly hack that uses the Allow handler to check read permissions |
| 241 | function hasReadPermissions (file, req, res, callback) { |
| 242 | const ldp = req.app.locals.ldp |
| 243 | |
| 244 | if (!ldp.webid) { |
| 245 | // FIXME: what is the rule that causes |
| 246 | // "Unexpected literal in error position of callback" in `npm run standard`? |
| 247 | |
| 248 | return callback(true) |
| 249 | } |
| 250 | |
| 251 | const root = ldp.resourceMapper.resolveFilePath(req.hostname) |
| 252 | const relativePath = '/' + _path.relative(root, file) |
| 253 | res.locals.path = relativePath |
| 254 | // FIXME: what is the rule that causes |
| 255 | // "Unexpected literal in error position of callback" in `npm run standard`? |
| 256 | |
| 257 | allow('Read')(req, res, err => callback(!err)) |
| 258 | } |
no test coverage detected