Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/Fixed Extended User Model Support #93

Closed
wants to merge 6 commits into from
Closed

Feature/Fixed Extended User Model Support #93

wants to merge 6 commits into from

Conversation

clockworkgr
Copy link

This should allow for full extended model support.

All relations are defined in code by PassportConfigurator and given the correct foreignKeys which are named from the extended User Model.

The foreignKey in each relation is used to set the correct property name in all references.

Unfortunately computed property name support is not in node yet so we have to do this:

         var userDataObj={
           provider: provider,
           externalId: profile.id,
           authScheme: authScheme,
           profile: profile,
           credentials: credentials,   
           created: date,
           modified: date
         };
         userDataObj[userIdentityModel.relations.user.keyFrom]= user.id;
         userIdentityModel.create(userDataObj, function (err, identity) {
....

instead of :

         userIdentityModel.create({
           provider: provider,
           externalId: profile.id,
           authScheme: authScheme,
           profile: profile,
           [userIdentityModel.relations.user.keyFrom]: user.id,
           credentials: credentials,         
           created: date,
           modified: date
         }, function (err, identity) {
....

Tests have not been rewritten for these changes

@slnode
Copy link

slnode commented Oct 8, 2015

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

@diesal11
Copy link

+1, need this functionality in the package asap

@ianseyer
Copy link

So is this present now? How do we use it?

@julien-sarazin
Copy link

+1

@ianseyer
Copy link

+1

@jonathan-casarrubias
Copy link

For those -like me- who simply can not wait until this module is merged and released, I took @clockworkgr fix, I did just small tweaks and published under loopback-component-passport-c

So thanks to @clockworkgr fix, now we can assign a specific user model. its working for me now..

$ npm uninstall --save loopback-component-passport
$ npm install --save loopback-component-passport-c

Following the standard documentation from loopback should work -now it does-, the following method does what everyone would expect it to do.

passportConfigurator.setupModels({
 userModel: app.models.Account, // Now my users are stored in Account
 userIdentityModel: app.models.AccountIdentity,
 userCredentialModel: app.models.AccountCredential
});

Please consider that passing an app.models.user as is recommended in some loopback documentation would partially work, it does not only breaks conventions rules it only works when you run inside node, when you try to access through REST interface, it will try to search for users in "User" collection and not in "user" collection, thus breaking the system... storing in lowercased name collection, and searching in uppercase name collection.. therefore this is a big concern and requires immediate solution.

For that reason I encourage anyone willing to fix this issue in your project ASAP by using loopback-component-passport-c until the moment this is fixed in the core module.

Cheers
@jonathan-casarrubias

@markstuart
Copy link

Thanks @jonathan-casarrubias, I am currently using your fork of this library with the work done by @clockworkgr with an extended User model.

Perhaps @loay would have some time to review this and hopefully merge so that those of us with extended user models don't get left behind?

@slnode
Copy link

slnode commented Feb 1, 2016

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

@enceladus
Copy link

+1. Using the fork @jonathan-casarrubias made until it's merged — working perfectly.

@slnode
Copy link

slnode commented Apr 12, 2016

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

@jonathan-casarrubias
Copy link

No problem guys, is good to help..

For more loopback packages and mixings follow me at twitter https://twitter.com/johncasarrubias I have been publishing other components for this framework that may be of your interest.

Cheers
@jonathan-casarrubias

@bennyt2
Copy link

bennyt2 commented Jun 6, 2016

+1 using the @jonathan-casarrubias fork and it works just as intended. I'll keep using it until it's merged. Thank you!

@slnode
Copy link

slnode commented Jul 22, 2016

Can one of the admins verify this patch?

This reverts commit 8d08fbe.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet