Skip to content

Commit

Permalink
Checking ID in a proper method.
Browse files Browse the repository at this point in the history
  • Loading branch information
elszczepano committed Dec 30, 2018
1 parent 35f5389 commit d68b39f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/middlewares/checkOwnership.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
export default (req, res, next) => {
const { _id } = req.user;
const { id } = req.params;
if(_id == id) next();
if(req.user._id.equals(req.params.id)) next();
else res.status(403).json({
success: false,
message: 'Access denied. User not permitted.'
Expand Down

0 comments on commit d68b39f

Please sign in to comment.