fix: root admin access deny bug + patreon link

This commit is contained in:
Nicolas Giard
2019-01-25 17:19:52 -05:00
committed by Nick
parent 8f573ffd01
commit 72253f9cb5
8 changed files with 19 additions and 19 deletions

View File

@@ -30,6 +30,7 @@ router.get(['/e', '/e/*'], async (req, res, next) => {
})
if (page) {
if (!WIKI.auth.checkAccess(req.user, ['manage:pages'], pageArgs)) {
_.set(res.locals, 'pageMeta.title', 'Unauthorized')
return res.render('unauthorized', { action: 'edit'})
}
@@ -40,6 +41,7 @@ router.get(['/e', '/e/*'], async (req, res, next) => {
page.content = Buffer.from(page.content).toString('base64')
} else {
if (!WIKI.auth.checkAccess(req.user, ['write:pages'], pageArgs)) {
_.set(res.locals, 'pageMeta.title', 'Unauthorized')
return res.render('unauthorized', { action: 'create'})
}
@@ -78,6 +80,7 @@ router.get(['/h', '/h/*'], async (req, res, next) => {
const pageArgs = pageHelper.parsePath(req.path)
if (!WIKI.auth.checkAccess(req.user, ['read:pages'], pageArgs)) {
_.set(res.locals, 'pageMeta.title', 'Unauthorized')
return res.render('unauthorized', { action: 'history'})
}