refactor fix: default empty object before polymorphic check
Per @bajtos recommendation https://github.com/strongloop/loopback/pull/3921#issuecomment-398307719
This commit is contained in:
parent
778395e6d5
commit
c5cf2f1e05
|
@ -458,9 +458,10 @@ app._verifyAuthModelRelations = function() {
|
|||
|
||||
function verifyUserRelations(Model) {
|
||||
const hasManyTokens = Model.relations && Model.relations.accessTokens;
|
||||
|
||||
const relationsConfig = Model.settings.relations || {};
|
||||
const hasPolyMorphicTokens = (relationsConfig.accessTokens || {}).polymorphic;
|
||||
// display a temp warning message for users using multiple users config
|
||||
if (hasManyTokens && Model.settings.relations.accessTokens.polymorphic) {
|
||||
if (hasPolyMorphicTokens) {
|
||||
console.warn(
|
||||
'The app configuration follows the multiple user models setup ' +
|
||||
'as described in http://ibm.biz/setup-loopback-auth',
|
||||
|
@ -470,7 +471,6 @@ app._verifyAuthModelRelations = function() {
|
|||
|
||||
if (hasManyTokens) return;
|
||||
|
||||
const relationsConfig = Model.settings.relations || {};
|
||||
const accessTokenName = (relationsConfig.accessTokens || {}).model;
|
||||
if (accessTokenName) {
|
||||
console.warn(
|
||||
|
|
Loading…
Reference in New Issue