Commit Graph

1763 Commits

Author SHA1 Message Date
Raymond Feng b627220059 Merge branch 'polymorphic-scoped-inclue' of https://github.com/mrfelton/loopback into mrfelton-polymorphic-scoped-inclue 2015-05-22 09:20:20 -07:00
Tom Kirkpatrick d6c8d9725a Fix code standards issues 2015-05-14 22:09:51 +02:00
Raymond Feng fb50b880ec 2.18.0
* Make the test compatible with latest juggler (Raymond Feng)
2015-05-13 16:28:50 -07:00
Raymond Feng b3b6df3fd0 Merge pull request #1391 from strongloop/feature/connector-refactor
Make the test compatible with latest juggler
2015-05-13 16:27:38 -07:00
Raymond Feng 20c9695591 Make the test compatible with latest juggler 2015-05-13 12:52:31 -07:00
Tom Kirkpatrick 8fa736517a Add test case to highlight fatal error when trying to include a scoped relationship through a polymorphic relationship 2015-05-13 18:47:30 +02:00
Ritchie Martori 28a0537e81 2.17.3
* Use the new remoting.authorization hook for check access (Ritchie Martori)

 * Define remote methods via model settings/config (Miroslav Bajtoš)

 * Pass the full options object to the email send method in user verification process. (Alexandru Savin)

 * un-document _findLayerByHandler (Rand McKinney)

 * Gruntfile: disable debug & watch for CI builds (Miroslav Bajtoš)

 * Update devDependencies to the latest versions (Miroslav Bajtoš)

 * Remove trailing whitespace added by 242bcec (Miroslav Bajtoš)

 * Update model.js (Rand McKinney)
2015-05-12 16:15:18 -07:00
Ritchie Martori 805e0e0c1c Merge pull request #1370 from strongloop/fix/check-access-ordering
Use the new remoting.authorization hook for check access
2015-05-12 16:06:47 -07:00
Ritchie Martori 9cde2a45be Use the new remoting.authorization hook for check access 2015-05-12 15:33:05 -07:00
Miroslav Bajtoš 019488fe83 Merge pull request #1366 from strongloop/feature/remote-methods-in-json
Define remote methods via model settings/config
2015-05-12 17:32:32 +02:00
Miroslav Bajtoš f93b69ed0a Define remote methods via model settings/config
Process `settings.methods` and `config.methods` as a key-value map
where the key is the method name and the value is an object describing
the method in the format expected by strong-remoting.

Example: a static method `Model.create`

    "methods": {
      "create": {
        "isStatic": true,
        "accepts": {
           "arg": "data", "type": "Car",
           "http": { "source": "body" }
        },
        "returns": { "arg": "data", "type": "Car", "root": true }
      }
    }

This patch is based on the code proposed by @mrfelton in #1163.
2015-05-07 07:42:08 +02:00
Ritchie Martori 694ab814f9 Merge pull request #1368 from alexandrusavin/master
Pass the full options object to the email send method in user verification process
2015-05-06 09:47:55 -07:00
Alexandru Savin f70c209526 Pass the full options object to the email send method in user verification process. 2015-05-06 15:52:07 +02:00
Rand McKinney ce26141d85 un-document _findLayerByHandler 2015-05-04 12:23:21 -07:00
Miroslav Bajtoš df04e9d17f Merge pull request #1357 from strongloop/fix-build-on-iojs
Fix CI builds on io.js
2015-05-04 18:55:52 +02:00
Miroslav Bajtoš 581df35d22 Gruntfile: disable debug & watch for CI builds
This fixes the following error on io.js:

Fatal error: Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
    at String.match (native)
    at Object.exports.fromSource (node_modules/karma-browserify/node_modules/convert-source-map/index.js:109:19)
    at updateSourceMap (node_modules/karma-browserify/lib/bro.js:326:23)
    at Browserify.<anonymous> (node_modules/karma-browserify/lib/bro.js:351:9)
    at Browserify.g (events.js:257:16)
    at emitTwo (events.js:92:20)
    at Browserify.emit (events.js:169:7)
    at node_modules/karma-browserify/lib/bro.js:263:11
    at node_modules/browserify/index.js:758:13
    at ConcatStream.<anonymous> (node_modules/browserify/node_modules/concat-stream/index.js:36:43)
2015-05-04 18:30:01 +02:00
Miroslav Bajtoš 3435fc959a Update devDependencies to the latest versions 2015-05-04 18:29:50 +02:00
Miroslav Bajtoš cad616ed22 Remove trailing whitespace added by 242bcec 2015-05-04 18:19:13 +02:00
Rand McKinney 242bcec539 Update model.js
Add `extend()` method to API docs.
2015-04-28 10:06:14 -07:00
Miroslav Bajtoš b9493cdb45 2.17.2
* Fix regression in Model.getApp() (Miroslav Bajtoš)
2015-04-28 18:08:55 +02:00
Miroslav Bajtoš ff5f507560 Merge pull request #1343 from strongloop/fix/app-getApp
Fix regression in Model.getApp()
2015-04-28 18:08:27 +02:00
Miroslav Bajtoš b6b76d538c Fix regression in Model.getApp()
This patch fixes the method Model.getApp() that started to report
the following error after b61fae5 was landed:

assert.js:88
  throw new assert.AssertionError({
        ^
AssertionError: undefined == true
    at loopback/loopback/lib/model.js:392:7
    at EventEmitter.<anonymous> (loopback/loopback/lib/model.js:222:9)
    at EventEmitter.g (events.js:257:16)
    at emitOne (events.js:77:13)
    at EventEmitter.emit (events.js:166:7)
    at EventEmitter.app.model (loopback/loopback/lib/application.js:157:9)
2015-04-28 12:49:57 +02:00
Miroslav Bajtoš f93590de1b 2.17.1
* Allow dataSource === false (Raymond Feng)

 * Fix remoting metadata for User.login#include (Miroslav Bajtoš)
2015-04-28 08:09:44 +02:00
Miroslav Bajtoš da50d6ffb0 Merge pull request #1332 from strongloop/fix/user-login-include
Fix remoting metadata for User.login#include
2015-04-28 08:08:25 +02:00
Raymond Feng 99d23bb7c4 Merge pull request #1329 from strongloop/feature/allow-datasource-false
Allow dataSource === false
2015-04-24 08:46:31 -07:00
Raymond Feng f798882e9a Allow dataSource === false 2015-04-24 08:32:17 -07:00
Miroslav Bajtoš 03d9f64c82 Fix remoting metadata for User.login#include
Change the type of the "include" argument to "string array".

The type used to be "string" before and thus requests sending multiple
include items were technically incorrect.
2015-04-24 08:58:30 +02:00
Raymond Feng 42318f428c 2.17.0
* Disable inclusion of User.accessTokens (Raymond Feng)

 * Upgrade test fixtures to use LB 2.x layout (Raymond Feng)
2015-04-21 10:46:42 -07:00
Raymond Feng a4121ee3d6 Merge pull request #1318 from strongloop/feature/disable-include-access-tokens
Disable inclusion of User.accessTokens
2015-04-21 10:43:41 -07:00
Raymond Feng bdc741520e Disable inclusion of User.accessTokens 2015-04-20 11:44:07 -07:00
Raymond Feng ca004adfc6 Merge pull request #1301 from strongloop/feature/disable-include-access-tokens
Upgrade test fixtures to 2.x project layouts
2015-04-20 11:43:19 -07:00
Raymond Feng 12e19e36ea Upgrade test fixtures to use LB 2.x layout 2015-04-20 09:23:44 -07:00
Miroslav Bajtoš 69b4972590 2.16.3
* Rework global registry to be per-module-instance (Miroslav Bajtoš)
2015-04-17 19:36:53 +02:00
Miroslav Bajtoš d84a6466ad Merge pull request #1311 from strongloop/fix/global-registry
Rework global registry to be per-module-instance
2015-04-17 19:33:10 +02:00
Miroslav Bajtoš f130b7aa01 Rework global registry to be per-module-instance
Fix a regression introduced by b917075 where two loopback projects,
each one using a different instance of loopback module, were
sharing the global registry and thus not working correctly.

The issue was discovered by unit-tests in loopback-workspace.
2015-04-17 19:26:05 +02:00
Miroslav Bajtoš 73ee01f27c 2.16.1
* Add back loopback properties like modelBuilder (Miroslav Bajtoš)
2015-04-17 18:35:30 +02:00
Miroslav Bajtoš 7e99912669 Merge pull request #1310 from strongloop/fix/regression-in-loopback-props
Add back loopback properties like modelBuilder
2015-04-17 18:34:55 +02:00
Miroslav Bajtoš 4d0a824757 Add back loopback properties like modelBuilder
The commit b917075 accidentally removed a couple of properties,
this commit is bringing them back:

 - loopback.modelRegistry
 - loopback.defaultDataSources

A unit-test was added to prevent this kind of regressions in the future.
2015-04-17 18:05:25 +02:00
Raymond Feng 5158df8790 2.16.0
* Expose the `filter` argument for findById (Raymond Feng)

 * fixed the missing '.' in various description fields. (Edmond Lau)

 * Conflict resolution and Access control (Miroslav Bajtoš)

 * Fix the typo (Raymond Feng)

 * Fix PersistedModel._defineChangeModel (Miroslav Bajtoš)

 * AccessControl for change replication (Miroslav Bajtoš)

 * test: remove global autoAttach (Miroslav Bajtoš)

 * Add support for app level Model isolation (Ritchie Martori)

 * Implement ModelCtor.afterRemoteError (Miroslav Bajtoš)

 * Code cleanup, add Model._runWhenAttachedToApp (Miroslav Bajtoš)

 * Refactor Model and PersistedModel registration (Miroslav Bajtoš)

 * Fix the style issue (Raymond Feng)

 * Add missing error handlers to checkpoints() (Miroslav Bajtoš)

 * Fix where param format (Rand McKinney)

 * Test embedsOne CRUD methods (Fabien Franzen)
2015-04-16 15:13:49 -07:00
Raymond Feng 3dcde7994b Merge pull request #1306 from strongloop/feature/allow-filter-on-findById
Expose the `filter` argument for findById
2015-04-16 15:12:50 -07:00
Raymond Feng 2bf69a1171 Expose the `filter` argument for findById 2015-04-16 15:02:41 -07:00
Miroslav Bajtoš b6a278861f Merge pull request #1304 from edlau/master
fixed the missing '.' in various description fields.
2015-04-16 13:52:47 +02:00
Edmond Lau ef7c1439b6 fixed the missing '.' in various description fields. 2015-04-15 09:47:38 -04:00
Miroslav Bajtoš bd973def63 Merge pull request #1294 from strongloop/feature/conflict-resolution-access-control
Conflict resolution and Access control
2015-04-14 09:36:40 +02:00
Miroslav Bajtoš cf2acb3cd2 Conflict resolution and Access control
Add end-to-end unit-tests verifying enforcement of access control during
conflict resolution.

Implement two facade methods providing REST API for Change methods used
by conflict resolution:

    PersistedModel.findLastChange
    GET /api/{model.pluralName}/{id}/changes/last

    PersistedModel.updateLastChange
    PUT /api/{model.pluralName}/{id}/changes/last

By providing these two methods on PersistedModel, replication users
don't have to expose the Change model via the REST API. What's even
more important, these two methods use the same set of ACL rules
as other (regular) PersistedModel methods.

Rework `Conflict.prototype.changes()` and `Conflict.prototype.resolve()`
to use these new facade methods.

Implement a new method `Conflict.prototype.swapParties()` that provides
better API for the situation when a conflict detected in Remote->Local
replication should be resolved locally (i.e. in the replication target).
2015-04-14 08:23:24 +02:00
Raymond Feng b4c487b191 Fix the typo 2015-04-10 11:03:55 -07:00
Miroslav Bajtoš 28acffd7dd Fix PersistedModel._defineChangeModel
Correctly handle the case when the model is attached multiple times
during the lifecycle, this happens because `loopback.createModel`
always makes an attempt to auto-attach.
2015-04-08 11:55:03 +02:00
Miroslav Bajtoš b18d2516a4 Merge pull request #1270 from strongloop/feature/replication-access-control
Basic access control for change replication
2015-04-07 20:00:27 +02:00
Miroslav Bajtoš 9c5fe088e3 AccessControl for change replication
1) Add integration tests running change replication over REST to verify
that access control at model level is correctly enforced.

2) Implement a new access type "REPLICATE" that allows principals
to create new checkpoints, even though they don't have full WRITE
access to the model. Together with the "READ" permission, these
two types allow principals to replicate (pull) changes from the server.

Note that anybody having "WRITE" access type is automatically
granted "REPLICATE" type too.

3) Add a new model option "enableRemoteReplication" that exposes
replication methods via strong remoting, but does not configure
change rectification. This option should be used the clients
when setting up Remote models attached to the server via the remoting
connector.
2015-04-07 19:53:58 +02:00
Miroslav Bajtoš 699bc7aa97 test: remove global autoAttach 2015-04-07 15:25:18 +02:00