mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-24 14:41:19 +00:00
added null check on user when checking permissions
This commit is contained in:
parent
2b8dd7248a
commit
f61d97a4f6
1 changed files with 3 additions and 1 deletions
|
@ -89,7 +89,9 @@ module.exports = SecurityManager =
|
||||||
|
|
||||||
requestIsOwner : (req, res, next)->
|
requestIsOwner : (req, res, next)->
|
||||||
getRequestUserAndProject req, res, {}, (err, user, project)->
|
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()
|
next()
|
||||||
else
|
else
|
||||||
logger.log user_id: user?._id, email: user?.email, "user is not owner of project redirecting to restricted page"
|
logger.log user_id: user?._id, email: user?.email, "user is not owner of project redirecting to restricted page"
|
||||||
|
|
Loading…
Reference in a new issue