Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
locking down user service more. Closes #92
Browse files Browse the repository at this point in the history
  • Loading branch information
ekryski committed Mar 30, 2016
1 parent bece37c commit 9c68594
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions generators/service/templates/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,29 @@ exports.before = {
get: [<% if (authentication && name === 'user') { %>
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated()
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: <% if (database === 'mongodb' || database === 'nedb') { %>'_id'<% } else { %>'id'<% } %> })
<% } %>],
create: [<% if (authentication && name === 'user') { %>
auth.hashPassword()
<% } %>],
update: [<% if (authentication && name === 'user') { %>
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated()
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: <% if (database === 'mongodb' || database === 'nedb') { %>'_id'<% } else { %>'id'<% } %> })
<% } %>],
patch: [<% if (authentication && name === 'user') { %>
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated()
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: <% if (database === 'mongodb' || database === 'nedb') { %>'_id'<% } else { %>'id'<% } %> })
<% } %>],
remove: [<% if (authentication && name === 'user') { %>
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated()
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: <% if (database === 'mongodb' || database === 'nedb') { %>'_id'<% } else { %>'id'<% } %> })
<% } %>]
};

Expand Down

0 comments on commit 9c68594

Please sign in to comment.