feat: sidebar item permissions + admin nav edit

This commit is contained in:
NGPixel
2020-04-18 18:25:16 -04:00
committed by Nicolas Giard
parent 9a93ac28f2
commit 8aba5305d8
14 changed files with 287 additions and 252 deletions

View File

@@ -25,7 +25,7 @@ const bruteforce = new ExpressBrute(new BruteKnex({
router.get('/login', async (req, res, next) => {
_.set(res.locals, 'pageMeta.title', 'Login')
if (req.query.legacy || req.get('user-agent').indexOf('Trident') >= 0) {
if (req.query.legacy || (req.get('user-agent') && req.get('user-agent').indexOf('Trident') >= 0)) {
const { formStrategies, socialStrategies } = await WIKI.models.authentication.getStrategiesForLegacyClient()
res.render('legacy/login', {
err: false,

View File

@@ -395,7 +395,7 @@ router.get('/*', async (req, res, next) => {
if (page) {
_.set(res.locals, 'pageMeta.title', page.title)
_.set(res.locals, 'pageMeta.description', page.description)
const sidebar = await WIKI.models.navigation.getTree({ cache: true, locale: pageArgs.locale })
const sidebar = await WIKI.models.navigation.getTree({ cache: true, locale: pageArgs.locale, groups: req.user.groups })
const injectCode = {
css: WIKI.config.theming.injectCSS,
head: WIKI.config.theming.injectHead,