-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Warn on misconfigured access token user #3231
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
abf8246
c45954c
f0c9700
79f441b
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 |
|---|---|---|
|
|
@@ -4,6 +4,9 @@ | |
| // License text available at https://opensource.org/licenses/MIT | ||
|
|
||
| 'use strict'; | ||
|
|
||
| const assert = require('assert'); | ||
|
|
||
| module.exports = function(registry) { | ||
| // NOTE(bajtos) we must use static require() due to browserify limitations | ||
|
|
||
|
|
@@ -52,8 +55,33 @@ module.exports = function(registry) { | |
| require('../common/models/checkpoint.js')); | ||
|
|
||
| function createModel(definitionJson, customizeFn) { | ||
| // Clone the JSON definition to allow applications | ||
| // to modify model settings while not affecting | ||
| // settings of new models created in the local registry | ||
| // of another app. | ||
| // This is needed because require() always returns the same | ||
| // object instance it loaded during the first call. | ||
| definitionJson = cloneDeepJson(definitionJson); | ||
|
|
||
| var Model = registry.createModel(definitionJson); | ||
| customizeFn(Model); | ||
| return Model; | ||
| } | ||
| }; | ||
|
|
||
| // Because we are cloning objects created by JSON.parse, | ||
| // the cloning algorithm can stay much simpler than a general-purpose | ||
| // "cloneDeep" e.g. from lodash. | ||
| function cloneDeepJson(obj) { | ||
|
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. I think it should be fine to use
Member
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. We are trying to avoid using |
||
| const result = Array.isArray(obj) ? [] : {}; | ||
| assert.equal(Object.getPrototypeOf(result), Object.getPrototypeOf(obj)); | ||
| for (const key in obj) { | ||
| const value = obj[key]; | ||
| if (typeof value === 'object') { | ||
| result[key] = cloneDeepJson(value); | ||
| } else { | ||
| result[key] = value; | ||
| } | ||
| } | ||
| return result; | ||
| } | ||
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.
@crandmck I setup
http://ibm.biz/setup-loopback-authshortcut to point tohttp://loopback.io/doc/en/lb3/Authentication-authorization-and-permissions.html#preparing-access-control-models. If/when you move the setup instructions to a different page, then we need to change the target url of the shortcuthttp://ibm.biz/setup-loopback-authpoints to.