diff --git a/lib/header.mjs b/lib/header.mjs index ed748623e..c3d418c1a 100644 --- a/lib/header.mjs +++ b/lib/header.mjs @@ -119,8 +119,8 @@ export async function addPermissions (req, res, next) { const ldp = req.app.locals.ldp const resource = ldp.resourceMapper.resolveUrl(req.hostname, req.path) let [publicPerms, userPerms] = await Promise.all([ - getPermissionsFor(acl, null, req), - getPermissionsFor(acl, session.userId, req) + getPermissionsFor(acl, null), + getPermissionsFor(acl, session.userId) ]) if (resource.endsWith('.acl') && userPerms === '' && await ldp.isOwner(session.userId, req.hostname)) userPerms = 'control' debug.ACL(`Permissions on ${resource} for ${session.userId || '(none)'}: ${userPerms}`) @@ -130,8 +130,8 @@ export async function addPermissions (req, res, next) { next() } -// Gets the permissions string for the given user and resource -async function getPermissionsFor (acl, user, req) { +// Gets the permissions string for the given user +async function getPermissionsFor (acl, user) { const accesses = MODES.map(mode => acl.can(user, mode)) const allowed = await Promise.all(accesses) return PERMISSIONS.filter((mode, i) => allowed[i]).join(' ')