Commit Graph

494 Commits

Author SHA1 Message Date
Amir Jafarian e562137807 Expose `Replace*` methods
*Re-mapping `updateAttributes` endpoint to use
`PATCH` and `PUT`(configurable) verb
*Exposing `replaceById` and `replaceOrCreate` via
`POST` and `PUT`(configurable) verb
2016-08-15 12:17:36 -04:00
Loay d8aa6bdf00 Add bcrypt validation
https://github.com/strongloop/loopback/pull/2580
2016-08-15 09:55:23 -04:00
Miroslav Bajtoš 99dc1f9541 common: add KeyValueModel 2016-08-10 15:30:15 +02:00
Miroslav Bajtoš ca28e7ff9e Deprecate current-context API
Deprecate all current-context APIs in favour of loopback-context-cls.
2016-08-10 10:58:33 +02:00
Miroslav Bajtoš 81318e603d test: increase timeout to prevent CI failures
[back-port of #2591]
2016-08-08 16:09:08 +02:00
Miroslav Bajtoš 0eff26199c test: fix timeout in rest.middleware.test 2016-08-05 11:33:57 +02:00
Miroslav Bajtoš 2eec008e0e test: fix "socket hang up" error in app.test
Rework the test to always wait for the client request to finish before
calling the test done.
2016-08-05 10:54:42 +02:00
Miroslav Bajtoš 593fd6e042 test: increate timeout in Role test 2016-08-05 10:54:42 +02:00
Miroslav Bajtoš fc5f16d833 test: make status test more robust
Rework assertions to report helpful messages on failure.

Increase the "elapsed" limit from 100ms to 300ms to support our
slow CI machines.
2016-08-05 10:54:42 +02:00
Miroslav Bajtoš ed953a4c6f test: fix broken Role tests
Rework the test suite to always report errors and correctly signal
when async tests are done.

This should prevent spurious test failures on CI servers that are
difficult to troubleshoot, because the error is reported for different
test case.
2016-08-05 10:54:42 +02:00
Miroslav Bajtoš fea3b781a0 Update dependencies to their latest versions 2016-08-05 10:54:42 +02:00
jannyHou 7f5f8d6df5 Increase timeout 2016-08-03 11:11:09 -04:00
Candy 4a93935825 Merge pull request #2566 from strongloop/backport/fix_misconfigured-change-replication
Backport of #2565
2016-07-29 15:14:54 -04:00
Miroslav Bajtoš fa8ac8d324 Backport of #2565 2016-07-29 11:39:47 -04:00
Amir Jafarian 2ab599fdd1 Avoid calling deprecated methds
*Avoid calling deprecated
`getHttpMethod` and `getFullPath`
2016-07-28 11:29:25 -04:00
Miroslav Bajtoš 895629632f test: use local registry in test fixtures
Use local registry in test fixtures to prevent collision in globally
shared models.

Fix issues discoverd in auth implementation where the global registry
was used instead of the correct local one.
2016-07-27 15:06:32 +02:00
Loay a8f30af49d Fix test case error 2016-07-26 13:29:11 -04:00
Loay 619372e51e Backport/Fix security issue 580 2016-07-25 11:06:19 -04:00
Loay 4480cd92ab Fix verificationToken bug #2440 2016-06-17 11:16:06 -04:00
Benjamin Kroeger 7e051a7549 add missing unit tests for #2108
Subsequent token middleware tries to read `token.id`
when `enableDoublecheck: true`.
That caused a "Cannot read property `id` of `null`" error
when the first middleware didn't actually find a valid accessToken.

[back-port of #2227]
2016-06-13 15:30:28 +02:00
Miroslav Bajtoš b013e66883 test: increase timeouts on CI 2016-06-01 09:26:45 +02:00
Miroslav Bajtoš 75da4c7784 Deprecate getters for express 3.x middleware
In LoopBack 3.0, we are removing these getters, see #2394.
2016-05-31 18:58:10 +02:00
juehou 8fef4845f8 Resolver support return promise 2016-05-10 18:00:42 -04:00
Simon Ho 25ade96d27 Backport separate error checking and done logic 2016-05-06 14:07:38 -07:00
Supasate Choochaisri e89fbd7ce8 Clean up by removing unnecessary comments
Signed-off-by: Supasate Choochaisri <supasate.c@gmail.com>
2016-05-05 10:51:40 -07:00
Supasate Choochaisri 4798b2f8c9 Add feature to not allow duplicate role name
- Also fix jshint error in backported test
2016-05-05 10:51:28 -07:00
Ryan Graham 4d6f2e7ab7
update/insert copyright notices 2016-05-03 17:10:46 -07:00
Miroslav Bajtoš 53cd449c9c test/rest.middleware: use local registry
Rework tests in `test/rest.middleware.test.js` to not depend
on `app.autoAttach()` and global shared registry of Models. Instead,
each tests creates a fresh app instance with a new in-memory datasource
and a new set of Models.
2016-05-03 14:40:17 +02:00
Miroslav Bajtoš cae9786f0e Fix role.isOwner to support app-local registry 2016-05-03 14:39:29 +02:00
Miroslav Bajtoš 845c59eced test/user: use local registry
Rework User tests to not depend on `app.autoAttach()` and global shared
registry of Models. Instead, each tests creates a fresh app instance
with a new in-memory datasource and a new set of Models.
2016-05-03 14:39:06 +02:00
Supasate Choochaisri 2498c02f31 Add new feature to emit a `remoteMethodDisabled` event when disabling a remote method.
Signed-off-by: Supasate Choochaisri <supasate.c@gmail.com>
2016-04-29 16:29:50 -07:00
Benjamin Kröger e4b275243f Allow built-in token middleware to run repeatedly
Add two new options:

  - When `enableDoublecheck` is true, the middleware will run
    even if a previous middleware has already set `req.accessToken`
    (possibly to `null` for anonymous requests)

  - When `overwriteExistingToken` is true (and `enableDoublecheck` too),
    the middleware will overwrite `req.accessToken` set by a previous
    middleware instances.
2016-04-06 15:47:32 +02:00
Miroslav Bajtoš 50e3578992 Improve error message on connector init error
[back-port of pull request #2105]
2016-03-02 13:19:20 +01:00
Miroslav Bajtoš e98ed99fe7 Fix race condition in replication tests 2016-02-05 12:39:20 +01:00
Ryan Graham a0806eab89 test: remove errant console.log from test
Using console.log like this can result in invalid xml when the xunit
reporter is used.

[Backport of pull request #2035]
2016-02-05 09:22:43 +01:00
Jue Hou 7a54da5870 Promisify Model Change
* Change.diff
* Change.findOrCreateChange
* Change.rectifyModelChanges
* Change.prototype.currentRevision
* Change.prototype.rectify
2016-02-04 16:01:45 -05:00
Miroslav Bajtoš 76ec49c96b Fix race condition in error handler test 2016-02-04 16:59:28 +01:00
Miroslav Bajtoš a0a1083564 Hide verificationToken
We should never be showing this publically.

Adds unit test for hiding verification token.

This is a back-port of pull request #1851 from gausie/patch-4
2016-02-04 16:27:03 +01:00
Ryan Graham aff49ff63f test: fail on error instead of crash
If the supertest request fails its basic assertions, there may not even
be a body to perform checks against, so bail early when possible.
2016-02-04 16:12:27 +01:00
Ryan Graham 17bd101691 ensure app is booted before integration tests 2016-02-04 16:12:27 +01:00
Amir Jafarian 8deec2e89a Checkpoint speedup 2016-01-19 10:28:53 -05:00
Amir Jafarian 4aac2776a8 Fix bulkUpdate to not trigger rectifyAll
Fix `getIdFromWhereByModelId()` to correctly detect the situation
when "bulkUpdate" performs a write operation using a where filter
containing both id attribute but also all other model attributes.

This should significantly improve the performance of change replication,
because the cost of running rectifyAll is very high.
2015-12-22 10:44:28 +01:00
Miroslav Bajtoš 1b765922c9 Merge pull request #1860 from strongloop/fix/replication-performance
Fix replication performance
2015-12-08 19:32:57 +01:00
Miroslav Bajtoš d2aaca7460 Change: correctly rectify no-change
Modify `Change.rectify()` to not make any changes to the Change instance
(most notably to not modify the `checkpoint` field) when the tracked
model instance was not changed.

This should improve the performance of change replication as it reduces
the number of unnecessary replications.

For example, before this commit, every run of `rectifyAll` would
trigger a full sync of all clients, because all change instances would
be moved to the current checkpoint.
2015-12-07 14:13:25 +01:00
Richard Pringle 2cca83c4ff Add case-sensitve email option for User model. 2015-12-03 13:18:49 -05:00
Miroslav Bajtoš 36cd5a7a78 lib/registry: fix findModel for model ctor
Fix `registry.findModel(arg)` to support the case when `arg` is already
a model constructor.
2015-11-09 16:01:43 +01:00
Simo Moujami 403e677155 Fix user.resetPassword to fail on email not found 2015-11-02 12:55:24 +01:00
Samuel Gaus 351b8026a0 Do not include redundant ports in verify links
If the protocol and port match we can ignore the port for a more
visually appealing link.
2015-10-12 16:24:30 +02:00
wusuopu ce48521efb Set application's id property only if it's empty.
Fix `Application.resetKeys()` to reset instance id only if it is not
already set. This fixes a bug where each call of resetKeys created
a new instance.
2015-10-12 11:23:33 +02:00
Simon Ho 26af1472e7 Check configs for shared method settings 2015-09-28 16:27:48 -07:00