Created
October 28, 2014 13:28
-
-
Save baudehlo/9e153d021a82b08c3ed1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
api.model.employees.get(req.params.id, function(err, employee) { | |
if (err) { | |
console.error("Error fetching employee from database"); | |
return res.send(500); | |
} | |
if (!employee) { | |
console.error("No such employee"); | |
return res.send(404); | |
} | |
if (employee.company_id != req.session.user.company.id) { | |
console.error("Attempt to fetch another user's company"); | |
return res.send(403); | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment