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

Function hasReadPermissions

lib/handlers/get.mjs:241–258  ·  view source on GitHub ↗
(file, req, res, callback)

Source from the content-addressed store, hash-verified

239
240// TODO: get rid of this ugly hack that uses the Allow handler to check read permissions
241function 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}

Callers 1

globHandlerFunction · 0.85

Calls 2

allowFunction · 0.85
resolveFilePathMethod · 0.80

Tested by

no test coverage detected