Closed markgargan closed 8 years ago
Also I have the following remote hook in my musician.js file
module.exports = function (Musician) {
//send verification email after registration Musician.afterRemote('create', function (context, Musician, next) { console.log('> Musician.afterRemote triggered'); }
which is never called?
For different access rights you should use roles instead of different user models. See: https://docs.strongloop.com/display/public/LB/Controlling+data+access
Check if the acl of the model is correct. You can find the default acl of the user model here: https://github.com/strongloop/loopback/blob/master/common/models/user.json
Also I would recommend you to enable acl debugging to find the error: See: https://docs.strongloop.com/display/public/LB/Setting+debug+strings
Hope this tipps help you to find the error.
@markgargan, did @gkTim's answer resolve you issue?
@richardpringle @gkTim Hi folks, I believe that the ACL might sort me out but my codebase currently isn't in a position to try it out. I believe this will fix it though so I'd be happy to mark this as an answer but I'm not sure how to do so?
Thanks, Mark.
Posted to SO at http://stackoverflow.com/questions/35785233/extending-builtin-user-in-strongloop
I have created a Musician model in Strongloop that extends the in-built User model.
The generated lb-services.js client service allows me to create a new Musician instance however when I attempt to login I get a 401 unauthorized error? However if I make the builtIn User create and login with the generated User service I can do it fine?
What is the best practice for creating an extended user model in strongloop where the user may take on multiple guises in different areas of the system? have a number of different identities within the system? I.e. a user is a Musician and Musician is the base model for a Guitarist/Bassist/drummer?
Each of the different User types would have different parameters?