Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/header.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
Expand All @@ -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(' ')
Expand Down