-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Correct PrinciplaType for multiple extension of User models #3679
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,7 +88,9 @@ function AccessContext(context) { | |
| var token = this.accessToken || {}; | ||
|
|
||
| if (token.userId) { | ||
| this.addPrincipal(Principal.USER, token.userId); | ||
| var userPrincipalType = | ||
| (this.accessToken && this.accessToken.principalType) || Principal.USER; | ||
| this.addPrincipal(userPrincipalType, token.userId); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change looks very reasonable to me 👍 and I am ok with landing it as an incremental improvement. However, I need you to add a test that fails on the current master, passes with your fix in place - this will verify your fix and prevent regressions in the future.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| if (token.appId) { | ||
| this.addPrincipal(Principal.APPLICATION, token.appId); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be shortened by using
tokeninstead ofaccessToken?Also please use
constinstead ofvarin new code - see http://loopback.io/doc/en/contrib/style-guide.html#variable-declarationsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll complete the patch soon.