mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-04 06:39:02 +02:00
added null check on user when checking permissions
This commit is contained in:
@@ -89,7 +89,9 @@ module.exports = SecurityManager =
|
||||
|
||||
requestIsOwner : (req, res, next)->
|
||||
getRequestUserAndProject req, res, {}, (err, user, project)->
|
||||
if userIsOwner user, project || user.isAdmin
|
||||
if !user?
|
||||
return res.redirect('/restricted')
|
||||
else if userIsOwner user, project || user.isAdmin
|
||||
next()
|
||||
else
|
||||
logger.log user_id: user?._id, email: user?.email, "user is not owner of project redirecting to restricted page"
|
||||
|
||||
Reference in New Issue
Block a user