fix: Fixed socket.io guest authorization + rights

This commit is contained in:
NGPixel
2017-04-29 17:42:33 -04:00
parent 5c9fe14723
commit ed0253cd0d
6 changed files with 14 additions and 10 deletions

View File

@@ -1,10 +1,16 @@
'use strict'
/* global appconfig, rights */
/* eslint-disable standard/no-callback-literal */
const _ = require('lodash')
module.exports = (socket) => {
// Check if Guest
if (!socket.request.user.logged_in) {
socket.request.user = _.assign(rights.guest, socket.request.user)
}
// -----------------------------------------
// SEARCH
// -----------------------------------------
@@ -22,7 +28,7 @@ module.exports = (socket) => {
// TREE VIEW (LIST ALL PAGES)
// -----------------------------------------
if (socket.request.user.logged_in) {
if (appconfig.public || socket.request.user.logged_in) {
socket.on('treeFetch', (data, cb) => {
cb = cb || _.noop
entries.getFromTree(data.basePath, socket.request.user).then((f) => {