Commit Graph

501 Commits

Author SHA1 Message Date
Subramanian Krishnan 6e71a52e90 Make the app instance available to connectors 2016-08-29 14:57:43 +02:00
Amir Jafarian 55eb8d72e6 Reorder PATCH Vs PUT endpoints
* Reorder PATCH Vs PUT endpoints for update* methods
* Backport of #2670
2016-08-26 16:21:45 -04:00
Benjamin Kroeger c538aa764d resolve related models from correct registry
Also modify setup of test servers when ACL was used, force the app
to `loadBuiltinModels` with localRegistry.
2016-08-25 10:39:44 +02:00
Miroslav Bajtoš b221af7cf6 KeyValueModel: add API for listing keys
- Expose "keys()" at "GET /keys"
 - Add a dummy implementation for "iterateKeys" to serve a useful error
   message when the model is not attached correctly.
2016-08-18 13:34:29 +02:00
Carl Fürstenberg ba2fe0ee05 Fix token middleware crash
Fix token middleware to check if `req.loopbackContext` is active.
The context is not active for example when express-session calls
setImmediate which breaks CLS.
2016-08-17 13:42:43 +02:00
Miroslav Bajtoš 378aba60ae Merge pull request #2489 from STRML/mailAlias
Support 'alias' in mail transport config.
2016-08-16 16:19:45 +02:00
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
Samuel Reed 8bed218a74
Support 'alias' in mail transport config.
Useful if you need to set up multiple transports of the same type.
2016-07-05 10:48:24 -05: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