Fixed a few crashing bugs

This commit is contained in:
Michael Schmatz 2014-11-25 10:52:20 -05:00
parent d56f594d58
commit 30e08e2c99
2 changed files with 3 additions and 1 deletions

View file

@ -17,6 +17,8 @@ class EarnedAchievementHandler extends Handler
get: (req, res) ->
return @getByAchievementIDs(req, res) if req.query.view is 'get-by-achievement-ids'
unless req.user
return @sendDatabaseError(res, "You need to have a user to view earned achievements")
query = { user: req.user._id+''}
projection = {}

View file

@ -31,7 +31,7 @@ class LevelSessionHandler extends Handler
hasAccessToDocument: (req, document, method=null) ->
return true if req.method is 'GET' and document.get('submitted')
return true if ('employer' in (req.user.get('permissions') ? [])) and (method ? req.method).toLowerCase() is 'get'
return true if ('employer' in (req.user?.get('permissions') ? [])) and (method ? req.method).toLowerCase() is 'get'
super(arguments...)
getCodeLanguageCounts: (req, res) ->