trailsjs / sails-permissions

Comprehensive user permissions and entitlements system for sails.js and Waterline. Supports user authentication with passport.js, role-based permissioning, object ownership, and row-level security.
MIT License
418 stars 113 forks source link

Pluralize 'true' changes 'post /user' to 'post /users' #213

Closed gtheilman closed 8 years ago

gtheilman commented 8 years ago

I'm using sails-generate-ember-blueprints which requires that pluralize be set to 'true' in blueprints.js.

As a result, in order to add a new user, I'm having to post to '/users' rather than '/user'.

I'm sure what I need to do is put a custom route in routes.js to redirect requests to 'post /user' to the correct location. However, I can't figure out what location to use.

So far, I've tried

'post /user' :  'post /users'
'post /user' : 'post /user'

I'm thinking it probably needs to be something like

'post /user' : {
   'UserController.?????'
}

Any thoughts?

ryanwilliamquinn commented 8 years ago

I think you want to hit this endpoint: https://github.com/tjwebb/sails-auth/blob/master/api/controllers/UserController.js#L12

I would try: 'POST /users': 'UserController.create'

gtheilman commented 8 years ago

Thanks for the pointer. Part of the problem was I kept searching through the "sails-permission" directory for the endpoint rather than the "sails-auth" directory.

Unfortunately, neither

'POST /users': 'UserController.create'

nor

'POST /user': 'UserController.create'

fixes the problem. Sails still reports a 404 error when looking for /user. Works fine if /users is used, instead.

However, that's not an issue with sails-permissions, so I would consider this issue "closed".