Skip to content

Instantly share code, notes, and snippets.

@baudehlo
Created October 28, 2014 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baudehlo/9e153d021a82b08c3ed1 to your computer and use it in GitHub Desktop.
Save baudehlo/9e153d021a82b08c3ed1 to your computer and use it in GitHub Desktop.
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