{"action":"created","issue":{"url":"https://api.github.com/repos/tjwebb/sails-permissions/issues/132","labels_url":"https://api.github.com/repos/tjwebb/sails-permissions/issues/132/labels{/name}","comments_url":"https://api.github.com/repos/tjwebb/sails-permissions/issues/132/comments","events_url":"https://api.github.com/repos/tjwebb/sails-permissions/issues/132/events","html_url":"https://github.com/tjwebb/sails-permissions/issues/132","id":103392877,"number":132,"title":"PUT Rest API does not seem to work.","user":{"login":"ksylvan","id":1226059,"avatar_url":"https://avatars.githubusercontent.com/u/1226059?v=3","gravatar_id":"","url":"https://api.github.com/users/ksylvan","html_url":"https://github.com/ksylvan","followers_url":"https://api.github.com/users/ksylvan/followers","following_url":"https://api.github.com/users/ksylvan/following{/other_user}","gists_url":"https://api.github.com/users/ksylvan/gists{/gist_id}","starred_url":"https://api.github.com/users/ksylvan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksylvan/subscriptions","organizations_url":"https://api.github.com/users/ksylvan/orgs","repos_url":"https://api.github.com/users/ksylvan/repos","events_url":"https://api.github.com/users/ksylvan/events{/privacy}","received_events_url":"https://api.github.com/users/ksylvan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2015-08-27T00:20:50Z","updated_at":"2015-08-29T01:06:16Z","closed_at":null,"body":"From the documentatoin:\r\n\r\n\"With sails-permissions, new Users should only be created through the sails.js REST API, e.g.\r\n\r\n    POST /user\r\n    {\r\n      username: 'tjwebb',\r\n      email: 'me@traviswebb.com',\r\n      password: 'test1234'\r\n    }\r\n\r\nAnd I managed to create a new user (\"kayvan\") via POST to /user (while authenticated as admin).\r\n\r\n    sails> User.findByUsername('kayvan').then(console.log)\r\n    sails> [ { createdBy: 1,\r\n        owner: 3,\r\n        username: 'kayvan',\r\n        email: 'kayvansylvan@gmail.com',\r\n        createdAt: '2015-08-27T00:02:43.280Z',\r\n        updatedAt: '2015-08-27T00:02:43.316Z',\r\n        id: 3 } ]\r\n\r\nThe REST API for modifying a user would be to PUT to /:model/:record (e.g.) for my case, PUT to /user/3, so I do:\r\n\r\n    PUT /user/3\r\n    {\r\n        password: 'secretpassword'\r\n    }\r\n\r\nWhile authenticated as \"admin\" and I get a 404 response.\r\n\r\nWhen I do the same with PUT to /user/1, the PUT succeeds, but the passport password does not change, instead, I get a new field added to the User record:\r\n\r\n    [ { createdBy: 1,\r\n    owner: 1,\r\n    username: 'admin',\r\n    email: 'kayvan.sylvan@disney.com',\r\n    model: 5,\r\n    createdAt: '2015-08-23T07:24:42.986Z',\r\n    updatedAt: '2015-08-27T00:14:03.665Z',\r\n    id: 1,\r\n    password: 'secretpassword' } ]\r\n\r\nThere are two issues here:\r\n\r\n1) Why isn't the admin user authorized to PUT on some other user record?\r\n\r\n2) What is the right way for me to change a user password? (or the admin password) within the app?\r\n\r\nThanks!\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/tjwebb/sails-permissions/issues/comments/135924137","html_url":"https://github.com/tjwebb/sails-permissions/issues/132#issuecomment-135924137","issue_url":"https://api.github.com/repos/tjwebb/sails-permissions/issues/132","id":135924137,"user":{"login":"ksylvan","id":1226059,"avatar_url":"https://avatars.githubusercontent.com/u/1226059?v=3","gravatar_id":"","url":"https://api.github.com/users/ksylvan","html_url":"https://github.com/ksylvan","followers_url":"https://api.github.com/users/ksylvan/followers","following_url":"https://api.github.com/users/ksylvan/following{/other_user}","gists_url":"https://api.github.com/users/ksylvan/gists{/gist_id}","starred_url":"https://api.github.com/users/ksylvan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksylvan/subscriptions","organizations_url":"https://api.github.com/users/ksylvan/orgs","repos_url":"https://api.github.com/users/ksylvan/repos","events_url":"https://api.github.com/users/ksylvan/events{/privacy}","received_events_url":"https://api.github.com/users/ksylvan/received_events","type":"User","site_admin":false},"created_at":"2015-08-29T01:06:16Z","updated_at":"2015-08-29T01:06:16Z","body":"@ryanwilliamquinn Did you get a chance to look at why the PUT with { username: \"newusername\" } does not work with /user/2 but works as expected with /user/1?"}}