Commit Graph

472 Commits

Author SHA1 Message Date
Ritchie Martori 58e36514d6 Fix coercion for remoting on vanilla models 2014-09-03 11:33:20 -07:00
Raymond Feng 43dbfa288e Merge pull request #469 from britztopher/mailconnector-transports-issue460
Mailconnector transports issue460
2014-09-03 08:50:03 -07:00
Alexander Ryzhikov 58538f02b7 user#login include server crash fix
Signed-off-by: Alexander Ryzhikov <coobaha@gmail.com>
2014-09-03 09:58:49 +04:00
Clark Wang 2452dd1092 Add tests for hasManyThrough link with data
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-09-01 09:28:13 +08:00
Fabien Franzen 1067c94bf6 Tiny fix: correct url format 2014-08-30 17:00:36 +02:00
Fabien Franzen 33f3ba4549 Fix embedsMany/findById to return proper 404 response 2014-08-30 16:54:14 +02:00
Raymond Feng 9b97014b52 Merge pull request #504 from fabien/feature/embeds-one-remoting
Enable remoting for embedsOne relation
2014-08-29 09:30:49 -07:00
Raymond Feng e856f81d09 Merge pull request #503 from fabien/feature/scope-where
Allow 'where' argument for scoped count API
2014-08-29 09:30:38 -07:00
Miroslav Bajtoš 26b67ba757 registry: warn when dataSource is not specified
Modify `registry.configureModel()` to log a warning when `dataSource`
optiont is not specified at all.

Users should provide `dataSource: null` when the model is intentionally
not attached to any data-source.
2014-08-26 18:04:06 +02:00
Ritchie Martori 7dde6466e5 Only validate dataSource when defined (Fixes #482) 2014-08-26 17:49:15 +02:00
Fabien Franzen 6cfd1bb523 Fix tests 2014-08-26 15:25:45 +02:00
Jaka Hudoklin 19155242c1 Enable remoting for embedsOne relation
Signed-off-by: Jaka Hudoklin <jakahudoklin@gmail.com>
2014-08-26 15:25:45 +02:00
Fabien Franzen fc0c96bdc2 Allow 'where' argument for scoped count API
Note that the return value will be non-rooted, which is actually what
the
non-scoped /count method returns as well - fixes inconsistency.
2014-08-26 14:41:36 +02:00
britztopher ba48d042b8 added test and fixed changing passed in object within ctor 2014-08-14 15:44:36 -04:00
Raymond Feng 1c61cedee7 Make sure scoped methods are remoted
See https://github.com/strongloop/loopback/issues/454. It's regression in 2.x.
2014-08-08 15:55:47 -07:00
Raymond Feng 9fb0977433 Pass in remotingContext for ACL
See https://github.com/strongloop/loopback/issues/451
2014-08-07 22:19:27 -07:00
Raymond Feng a9e77e0e23 Merge pull request #435 from fabien/feature/deep-remoting
Implement Model.nestRemoting
2014-08-07 10:38:09 -07:00
Raymond Feng 0affc65c67 Merge pull request #427 from fabien/feature/relation-paths
Allow custom relation path (http) - enable hasOne remoting access
2014-08-07 10:32:13 -07:00
Fabien Franzen 539702ab3d Inherit hooks when nesting
Note that for now, the hook ctx.instance will be the root/entry object.

Added `mounted` event - should be useful in other ways too.
2014-08-05 12:14:39 +02:00
Fabien Franzen 18c647a9bb Changed options.path to options.http.path 2014-08-05 09:10:43 +02:00
Fabien Franzen 42f938ed72 Fix test to be more specific 2014-08-04 18:47:15 +02:00
Fabien Franzen 9be8d11431 Implement Model.nestRemoting
Explicitly enable another level of nesting/accessing relations; limited
to a depth of 2 levels.
2014-08-04 18:27:50 +02:00
Raymond Feng b66a36fd3c Merge pull request #423 from strongloop/feature/add-remoting-for-exists
Feature/add remoting for exists
2014-08-04 08:44:16 -07:00
Fabien Franzen 66fe60e6ca Allow custom relation path (http) - enable hasOne remoting access 2014-08-01 11:25:28 +02:00
Raymond Feng ad43d03ebb Expose Model.exists over HTTP HEAD 2014-07-30 21:57:45 -07:00
Raymond Feng 0590eaf278 Merge pull request #419 from fabien/feature/new-relations
Integration of the new juggler relations: embedsMany, referencesMany
2014-07-30 16:32:33 -07:00
Fabien Franzen b9f27d71a8 Integration test: referencesMany 2014-07-30 15:01:22 +02:00
Fabien Franzen 514db0bc66 Integration test: embedsMany 2014-07-30 13:24:40 +02:00
Raymond Feng e5b0e8cd70 Map exists to HEAD for REST 2014-07-28 09:37:50 -07:00
Raymond Feng 567e2530d7 Build the email verification url from app context
https://github.com/strongloop/loopback/issues/408
2014-07-26 22:39:42 -07:00
Raymond Feng 5bb4cde593 Update test case to remove usage of deprecated express apis 2014-07-26 14:37:13 -07:00
Raymond Feng af26e09845 Emit a 'modelRemoted' event by app.model()
This event will be listened by loopback-explorer so that models remoted
after the explorer is initiated will be added to the api specs
2014-07-24 17:00:27 -07:00
Raymond Feng ac1428eff5 Fix for email transports 2014-07-23 22:09:24 -07:00
Raymond Feng 13c876c154 Merge pull request #387 from strongloop/feature/fix-base-model
Set up the base model based on the connector types
2014-07-22 10:58:33 -07:00
Raymond Feng 7337f0a0de Enhance the base model assertions 2014-07-22 10:57:42 -07:00
Raymond Feng 335bae4b46 Merge branch 'master' into feature/fix-issue-377 2014-07-22 10:49:20 -07:00
Raymond Feng 21b8609ee2 Report error for User.confirm()
See https://github.com/strongloop/loopback/issues/377
2014-07-22 10:42:22 -07:00
Raymond Feng 643293cc25 Set up the base model based on the connector types 2014-07-22 10:38:14 -07:00
Raymond Feng 74e9ff75e3 Merge pull request #385 from offlinehacker/master
Validate username uniqueness
2014-07-21 15:26:01 -07:00
Raymond Feng 0dae813d5f Merge pull request #375 from strongloop/feature/upgrade-to-nodemailer-1.x
Upgrade to nodemailer 1.0.1
2014-07-21 11:58:17 -07:00
Miroslav Bajtoš eb5ef04b6a Remove `loopback.compat.usePluralNamesForRemoting`
The `usePluralNamesForRemoting` was added in January 2014 for users
upgrading from LoopBack 1.5 or older.
2014-07-21 16:56:46 +02:00
Jaka Hudoklin 90094e5e86 Validate username uniqueness
Signed-off-by: Jaka Hudoklin <jakahudoklin@gmail.com>
2014-07-19 14:18:21 +02:00
Raymond Feng e5b64c6143 Upgrade to nodemailer 1.0.1 2014-07-16 12:40:15 -07:00
Raymond Feng 79f504a3c7 Merge branch 'master' into 2.0 2014-07-16 09:09:07 -07:00
Raymond Feng 7b36196561 Merge pull request #362 from strongloop/feature/remoting-add-remove
Add a test case for hasMany through add/remove remoting
2014-07-15 16:15:27 -07:00
Raymond Feng 54b13f4feb Upgrade to loopback-datasource-juggler@1.7.0 2014-07-15 16:15:02 -07:00
Raymond Feng c5c28aa634 Merge pull request #368 from strongloop/feature/loopback-base-model
Refactor modelBuilder to registry and set up default model
2014-07-15 08:38:43 -07:00
Raymond Feng 3c13ce5a8f Refactor modelBuilder to registry and set up default model 2014-07-15 08:37:59 -07:00
Raymond Feng 76b6dc10d9 Add a test case for credentials/challenges 2014-07-15 08:20:47 -07:00
Miroslav Bajtoš 31ef6394b4 checkpoint: fix `current()`
Fix the query in `Checkpoint.current()` to correctly specify sorting
`seq DESC`. Before this change, the first checkpoint was returned as the
current one.
2014-07-11 17:07:22 +02:00
Raymond Feng 74a39f3fc2 Refactor email verification tests into a new group 2014-07-08 08:54:50 -07:00
Raymond Feng 0c67b1e781 Add an option to honor emailVerified
See https://github.com/strongloop/loopback/pull/215
2014-07-07 14:09:45 -07:00
Raymond Feng f649c92bcf Refine the test cases for relation REST APIs 2014-07-03 11:18:34 -07:00
Miroslav Bajtoš f0cc5f7534 test: add check of Model remote methods
The test ensures that Model has all methods listed in docs:

http://docs.strongloop.com/display/LB/Exposing+models+over+a+REST+API

See also #359.
2014-07-03 08:19:41 +02:00
Raymond Feng 0525f2c896 Adjust the REST mapping for add/remove 2014-07-02 23:06:11 -07:00
Raymond Feng b221714b38 Add a test case for hasMany through add/remove remoting 2014-07-02 18:09:05 -07:00
Raymond Feng 217c9fa348 Fix the typo and add Bearer token support
See https://github.com/strongloop/loopback/issues/333
2014-07-02 09:02:13 -07:00
Miroslav Bajtoš 8ea11ea955 Merge branch 'master' into 2.0
Land the pull request #357
> app: update `url` on `listening` event
2014-07-01 16:18:00 +02:00
Miroslav Bajtoš dfa8d7f49f app: update `url` on `listening` event
Most applications report the URL when started (at least the apps we
are scaffolding using loopback-workspace). Constructing the URL in the
loopback core allows us to simplify the templates and reduce the amount
of repeated code.
2014-07-01 14:27:02 +02:00
Miroslav Bajtoš 50816ebbe3 Fix loopback in PhantomJS, fix karma tests
- Move configuration of Karma unit-tests from `Gruntfile.js` to a
  standalone file (`test/karma.conf.js`).

- Add a new Grunt task `karma:unit-ci` to run Karma unit-tests in
  PhantomJS and produce karma-xunit.xml file that can be consumed
  by the CI server.

- Add grunt-mocha-test, configure it to run unit-tests.

- Add `grunt test` task that runs both karma and mocha tests,
  detects Jenkins to produce XML output on CI server.

- Modify the `test` script in `package.json` to run
  `grunt mocha-and-karma` (an alias for `grunt test`).
  The alias is required to trick `sl-ci-run` to run `npm test`
  instead of calling directly `mocha`.

- Add `es5-shim` module to karma unit-tests in order to provide
  ES5-methods required by LoopBack.

- Fix `mixin(source)` in lib/loopback.js to work in PhantomJS.
  `Object.getOwnPropertyDescriptor()` provided by `es5-shim` does not
  work in the same way as in Node.
2014-06-26 13:30:09 +02:00
Miroslav Bajtoš c896c78db0 Remove `app.boot`
Modify `app.boot` to throw an exception, pointing users to the new
module `loopback-boot`.
2014-06-25 14:09:06 +02:00
Raymond Feng 9eab7d62d3 Merge branch 'master' into 2.0 2014-06-20 23:48:46 -07:00
Raymond Feng b44dac3c62 Merge branch 'master' into 2.0 2014-06-20 23:08:35 -07:00
Raymond Feng 9b5d7417a2 Remove relationNameFor 2014-06-20 21:25:27 -07:00
Raymond Feng d5ed57e60d Merge pull request #254 from strongloop/feature/role-id
Set the role id to be generated
2014-06-17 10:37:06 -07:00
Miroslav Bajtoš 7316048afc lib/registry: `getModel` throws, add `findModel`
Rename `loopback.getModel` to `loopback.findModel`.

Implement `loopback.getModel` as a wrapper around `findModel` that
throws an error when the model as not found.
2014-06-16 16:13:24 +02:00
Miroslav Bajtoš 56c7a6b3c5 Merge branch 'master' into 2.0
Conflicts:
	test/access-token.test.js
2014-06-16 10:20:22 +02:00
Miroslav Bajtoš 8826b6396a Merge pull request #306 from karlmikko/master
Ability to return 401 and 403 response codes #301
2014-06-14 09:44:22 +02:00
Miroslav Bajtoš d2517d8236 Merge branch 'master' into 2.0 2014-06-14 09:40:57 +02:00
Karl Mikkelsen a90a5c7e58 Allow customization of ACL http status
emulate existing error on 404
new tests for model and app settings
Signed-off-by: Karl Mikkelsen <karl@karlmikko.com>
2014-06-14 11:31:15 +10:00
Miroslav Bajtoš c4db83ad43 Expose loopback as `app.loopback`
The primary intention is to allow loopback plugins to determine
the version of the loopback framework from the `app` object.
2014-06-13 10:34:51 +02:00
Miroslav Bajtoš d21669b844 Merge branch 'master' into 2.0
Conflicts:
	docs.json
	lib/application.js
	lib/loopback.js
	lib/models/data-model.js
	lib/models/model.js
	lib/models/user.js
	lib/registry.js
	package.json
	test/app.test.js
2014-06-13 10:09:25 +02:00
Miroslav Bajtoš 362cceb70a Merge createModelFromConfig with createModel
Merge the two methods `loopback.createModel` and
`loopback.createModelFromConfig` into a single method `createModel`.
2014-06-12 10:41:45 +02:00
Miroslav Bajtoš f0ff40d3f7 test: add debug logs
Add debug logs to troubleshoot two unit tests failing
on the CI server only.
2014-06-12 10:41:44 +02:00
Miroslav Bajtoš fc0fad4a9f Add createModelFromConfig and configureModel()
Add new API allowing developers to split the model definition and
configuration into two steps:

 1. Build models from JSON config, export them for re-use:

  ```js
  var Customer = loopback.createModelFromConfig({
    name: 'Customer',
    base: 'User',
    properties: {
      address: 'string'
    }
  });
  ```

 2. Attach existing models to a dataSource and a loopback app,
    modify certain model aspects like relations:

  ```js
  loopback.configureModel(Customer, {
    dataSource: db,
    relations: { /* ... */ }
  });
  ```

Rework `app.model` to use `loopback.configureModel` under the hood.
Here is the new usage:

```js
var Customer = require('./models').Customer;

app.model(Customer, {
  dataSource: 'db',
  relations: { /* ... */ }
});
```

In order to preserve backwards compatibility,
`app.model(name, config)` calls both `createModelFromConfig`
and `configureModel`.
2014-06-12 10:41:44 +02:00
Miroslav Bajtoš 3deadcd180 test: fix ACL integration tests
Change the tests creating new users so that they send valid user data,
in order to prevent 422 "validation failed" responses.

Upgrade loopback-testing to 0.2.0.
2014-06-12 10:33:40 +02:00
Raymond Feng e72ff61d99 Add a test case 2014-06-10 16:39:32 -07:00
Raymond Feng 7769174d58 Tidy up app.model() to remove duplicate & recusrive call 2014-06-09 23:53:01 -07:00
Raymond Feng 815ad53aa4 Register existing model to app.models during app.model() 2014-06-09 16:31:33 -07:00
Raymond Feng 6b4ebdf609 Allow the creation of access token to be overriden 2014-06-09 14:53:55 -07:00
Miroslav Bajtoš 56aab8dbdd Merge createModelFromConfig with createModel
Merge the two methods `loopback.createModel` and
`loopback.createModelFromConfig` into a single method `createModel`.
2014-06-09 11:18:52 +02:00
Miroslav Bajtoš 1de6325a80 test: add debug logs
Add debug logs to troubleshoot two unit tests failing
on the CI server only.
2014-06-06 14:51:43 +02:00
Miroslav Bajtoš 5f1c3a86eb Merge pull request #304 from strongloop/feature/createModelFromConfig
[2.0] Add createModelFromConfig and configureModel()
2014-06-06 10:27:03 +02:00
Miroslav Bajtoš f844459311 Add createModelFromConfig and configureModel()
Add new API allowing developers to split the model definition and
configuration into two steps:

 1. Build models from JSON config, export them for re-use:

  ```js
  var Customer = loopback.createModelFromConfig({
    name: 'Customer',
    base: 'User',
    properties: {
      address: 'string'
    }
  });
  ```

 2. Attach existing models to a dataSource and a loopback app,
    modify certain model aspects like relations:

  ```js
  loopback.configureModel(Customer, {
    dataSource: db,
    relations: { /* ... */ }
  });
  ```

Rework `app.model` to use `loopback.configureModel` under the hood.
Here is the new usage:

```js
var Customer = require('./models').Customer;

app.model(Customer, {
  dataSource: 'db',
  relations: { /* ... */ }
});
```

In order to preserve backwards compatibility with loopback 1.x,
`app.model(name, config)` calls both `createModelFromConfig`
and `configureModel`.
2014-06-05 17:47:28 +02:00
Miroslav Bajtoš ea5b9d16fc Rename DataModel to PersistedModel 2014-06-05 09:56:00 +02:00
Miroslav Bajtoš 26874fc715 Make app.get/app.set available in browser
Implement settings object and methods in browser-express.

Add test/app.test.js to unit-tests run by karma.
2014-06-03 21:32:27 +02:00
Ritchie Martori fea1cee1c4 !fixup only set ctx.accessType when sharedMethod is available 2014-06-02 14:41:08 -07:00
Ritchie Martori a2f931ed3f Refactor ACL to allow for `methodNames` / aliases 2014-06-02 14:41:08 -07:00
Raymond Feng 663e2d1903 Merge pull request #293 from strongloop/feature/express-4.x
Upgrade to Express 4.x
2014-06-02 08:26:35 -07:00
Miroslav Bajtoš 5b53da93db test: Remove forgotten call of `console.log()`
The `console.log()` call was added by 94ec5c2.
2014-06-02 08:34:08 +02:00
Raymond Feng 3c7cfcaca8 Clean up the tests 2014-05-29 10:18:14 -07:00
Raymond Feng 49380e490f Upgrade to Express 4.x 2014-05-29 08:44:05 -07:00
Miroslav Bajtoš 18fd61a546 Merge branch 'master' into 2.0 2014-05-28 18:41:36 +02:00
Miroslav Bajtoš 94ec5c294a app: implement `connector()` and `connectors`
Allow browserified applications to explicitly register connectors
to use in data-sources via `app.connector(name, exportsFromRequire)`.

Include built-in connectors like `Memory` and `Remote` in the registry.

Modify `dataSourcesFromConfig()` to resolve the connector via
`app.connectors` first and only then fall back to auto-require
the connector module.
2014-05-28 15:11:43 +02:00
Miroslav Bajtoš 7cfe450161 Make app.datasources unique per app instance
This removes a source of confusion in unit-tests.
2014-05-27 14:33:42 +02:00
Miroslav Bajtoš 227c2d05cd app: flatten model config
Support flat structure of model config objects, where model options
are set as top-level properties.

Before:

    Customer: {
      dataSource: 'db',
      options: {
        base: 'User'
      }
    }

Now:

    Customer: {
      dataSource: 'db',
      base: 'User'
    }
2014-05-27 08:10:20 +02:00
Raymond Feng ed0b568542 Fix the test for mocha 1.19.0
See 6c705cd4d4
2014-05-26 21:52:48 -07:00
Miroslav Bajtoš bfb154d445 Modify `loopback.rest` to include `loopback.token`
Make `loopback.rest` self-contained, so that authentication works
out of the box.

    var app = loopback();
    app.enableAuth();
    app.use(loopback.rest());

Note that cookie parsing middleware is not added, users have to
explicitly configure that if they want to store access tokens
in cookies.

Modify `loopback.token` to skip token lookup when the request already
contains `accessToken` property. This is in line with other
connect-based middleware like `cookieParser` or `json`.
2014-05-21 15:22:36 +02:00
Ritchie Martori 7eeed19bf0 Relax validation object test 2014-05-20 14:39:28 -07:00
Ritchie Martori d237ae5ddb Merge latest from master 2014-05-20 14:31:09 -07:00
Ritchie Martori eec7bdd5f4 - Use the RemoteObjects class to find remote objects instead of
creating a cache
 - Use the SharedClass class to build the remote connector
 - Change default base model from Model to DataModel
 - Fix DataModel errors not logging correct method names
 - Use the strong-remoting 1.4 resolver API to resolve dynamic remote
methods (relation api)
 - Remove use of fn object for storing remoting meta data
2014-05-19 15:56:26 -07:00
Ritchie Martori 4d5e7884c2 Add test for conflicts where both deleted 2014-05-16 09:58:23 -07:00
Miroslav Bajtoš 4b3d20e409 test/geo-point: relax too precise assertions
Relax the assertions to verify only the integer part of the distances.
The decimal part is subject to small variances depending on the exact
implementation of floating-point arithmetic.

For example, the distance calculated on Node v0.11.13 is different
than the distance calculated on Node v0.10.x.
2014-05-16 16:24:18 +02:00
Ritchie Martori 2f21f4ec1e Rework replication test 2014-05-15 17:30:58 -07:00
Ritchie Martori 5bf1f76762 !fixup Test cleanup 2014-05-07 07:44:00 -07:00
Ritchie Martori a3a6828709 Move replication implementation to DataModel 2014-05-06 13:31:23 -07:00
Ritchie Martori f8b5fa11ec All tests passing 2014-05-02 21:19:14 -07:00
Ritchie Martori ae2fb9dea0 !fixup use DataModel instead of Model for all data based models 2014-05-02 20:15:01 -07:00
Ritchie Martori e026a7f52c fixup! unskip failing tests 2014-05-02 20:07:59 -07:00
Ritchie Martori 012f880078 !fixup RemoteConnector tests 2014-05-02 20:04:06 -07:00
Ritchie Martori 1c7527ae3d Add missing test/model file 2014-05-02 18:12:50 -07:00
Ritchie Martori 918596f035 Refactor DataModel remoting
- Move DataModel remoting setup into setup phase
 - Add a remoting type converter for DataModels
 - Move model tests into re-usable test utilities
 - Move other test utilities into new test utilities folder
2014-05-02 18:12:24 -07:00
Ritchie Martori e35309ba27 Fixes for e2e replication / remote connector tests 2014-04-29 17:17:49 -07:00
Raymond Feng 921e35954d Rename the method so that it won't conflict with Model.checkAccess
See https://github.com/strongloop/loopback/issues/239
2014-04-21 11:13:03 -07:00
Ritchie Martori 83e74ab414 Merge 2014-04-16 07:39:13 -07:00
Ritchie Martori b660f8a59e Add replication e2e tests 2014-04-16 07:33:17 -07:00
Ritchie Martori e86a00de69 Merge branch master 2014-04-15 12:53:00 -07:00
Ritchie Martori 940e11125d Fix save implementation for remoting connector 2014-04-14 14:17:56 -07:00
Ritchie Martori 7c0a470d64 Add basic Remote connector e2e test 2014-04-14 12:25:41 -07:00
Ritchie Martori 5298834c68 Merge branch 'master' into feature/remoting-connector 2014-04-14 11:01:20 -07:00
Ritchie Martori 63ad8f69ae Add test for remoting nested hidden properties 2014-04-11 11:43:37 -07:00
Raymond Feng 8f50c9dede Add an assertion to the returned store object 2014-04-04 08:26:57 -07:00
Raymond Feng cdbf45c53a Add an integration test for belongsTo remoting 2014-04-03 20:46:30 -07:00
Ritchie Martori 5f81fad921 Merge pull request #217 from strongloop/feature/hidden-properties
Feature/hidden properties
2014-03-31 12:04:49 -07:00
Ritchie Martori 4c185e5453 Support host / port in Remote connector 2014-03-27 14:47:30 -07:00
Miroslav Bajtoš b1679803d9 test: add hasAndBelongsToMany integration test
* it allows to find related object via URL scope
  GET /api/categories/{cat-id}/products

* it allows to find related objects via where filter
  GET /api/products?filter[where][categoryId]={cat-id}
  (skipped for now)

* it includes requested related models in `find`
  GET /api/categories/findOne
      ?filter[where][id]=CAT-ID&filter[include]=products

* it includes requested related models in `findById`
  GET /api/categories/{cat-id}?include=products
  (skipped for now)
2014-03-25 19:38:15 +01:00
Ritchie Martori 5b50a99eb3 Add hidden property support to models 2014-03-21 12:53:04 -07:00
Ritchie Martori c521b3c386 Allow app.model() to accept a DataSource instance 2014-03-21 12:18:00 -07:00
Ritchie Martori de5d0b8949 Make verifications url safe 2014-03-21 12:02:11 -07:00
Raymond Feng 328a72ac91 Improve the ACL matching algorithm
See https://github.com/strongloop/loopback-example-access-control/issues/8
2014-03-19 15:09:20 -07:00
Miroslav Bajtoš 1aaf6eed35 Add test for request pausing during authentication 2014-03-18 08:43:24 +01:00
Raymond Feng f031e79392 Remove the generated flag as the id is set by the before hook 2014-03-17 10:01:29 -07:00
Raymond Feng 89aa3595f5 Set the correct status code for User.login
See https://github.com/strongloop/loopback/issues/118
2014-02-28 13:19:52 -08:00
Ritchie Martori 4e437586ed Merge pull request #192 from strongloop/fix/port-zero
Remove coercion from port check
2014-02-21 10:08:27 -08:00
Miroslav Bajtoš fe6ac0bebf Merge pull request #195 from globocom/fix-clear-handler-cache-test
Rewrites test for clear handler cache.
2014-02-21 18:51:55 +01:00
Raymond Feng 4a0c564c68 Merge pull request #196 from strongloop/feature/remoting-options
Allows options to be passed to strong-remoting
2014-02-21 09:10:37 -08:00
Raymond Feng 1717729efc Merge pull request #186 from albertoleal/RemoveUnnecessaryLines
Remove unnecessary lines
2014-02-21 09:06:11 -08:00
Guilherme Cirne f43273e5d7 Rewrite test for clear handler cache. 2014-02-20 14:39:57 -03:00
Raymond Feng 37646fa008 Allows options to be passed to strong-remoting 2014-02-19 15:14:31 -08:00
Ritchie Martori 138821cf8b Merge package.json and lib/loopback.js 2014-02-19 11:44:44 -08:00
Ritchie Martori 500703e1fb Remove coercion from port check 2014-02-18 16:54:40 -08:00
Ritchie Martori edd16b9ce8 Merge pull request #193 from globocom/clear-handler-cache2
Clear handler cache
2014-02-18 14:24:23 -08:00
Guilherme Cirne b466bb96c8 The simplest possible solution for clearing the handler cache when registering a model. 2014-02-18 17:40:35 -03:00
Ritchie Martori a313d1d140 Remove outdated test readme 2014-02-18 10:37:43 -08:00
Alberto Leal 6eecaa78a3 Remove unnecessary lines 2014-02-17 14:05:04 -03:00
Raymond Feng 46b579dc4a Make sure User/AccessToken relations are set up by default
User.login assumes the relation User.accessTokens exists
2014-02-14 10:31:30 -08:00
Ritchie Martori e7f64a3abf Add karma for running browser tests 2014-02-12 10:17:02 -08:00
Raymond Feng 618b563c6e Use hex encoding for application ids/keys
base64 encoded ids/keys are not friendly for urls
2014-02-07 11:14:01 -08:00
Ritchie Martori 0bf7af104d fixup! rename Change.track => rectifyModelChanges 2014-02-05 15:27:58 -08:00
Miroslav Bajtoš 38f4748021 Add app.isAuthEnabled.
The flag is set by `app.enableAuth` and can be used to detect
whether the access control is enabled.
2014-02-05 18:46:22 +01:00
Miroslav Bajtoš b13ff35697 Make app.models unique per app instance
Remove a source of confusion in unit-tests.
2014-02-04 20:28:19 +01:00
Miroslav Bajtoš 4a076f13fd Fix incorrect usage of `app` in app.test.js
The `beforeEach` hook was using a local `var app`, the test was
accessing global `app` created by `test/support.js`.
2014-02-04 20:27:14 +01:00
Raymond Feng 592f3f9278 Make sure the configured ACL submodel is used 2014-02-03 16:00:01 -08:00
Ritchie Martori 13f67385d0 Add model tests 2014-01-30 14:20:34 -08:00
Ritchie Martori cc49d675ce Add Change model 2014-01-30 14:20:33 -08:00
Miroslav Bajtoš d6f0b5f5a6 Add `include=user` param to `User.login`
Allow LB clients to get details of the currently logged-in user
as part of the login response.

Improve method's `description` to mention this new option.
2014-01-30 18:09:54 +01:00
Ritchie Martori a0e595dce8 Add model tests 2014-01-28 14:46:16 -08:00
Miroslav Bajtoš 20766e251a Add loopback.compat to simplify upgrade to 1.6
Add a compatibility layer that allows applications based on LB pre-v1.6
to work with 1.6 versions with a minimum amount of changes required.

New flag(s):
  compat.usePluralNamesForRemoting
2014-01-27 10:29:57 +01:00
Ritchie Martori 4be3395298 Add Change model 2014-01-26 13:20:19 -08:00
Raymond Feng f08b9427ab Add a test for autoAttach 2014-01-23 15:27:31 -08:00
Raymond Feng bcc7e68e0e Add lookback.getModelByType() and use it resolve model deps 2014-01-23 14:39:27 -08:00
Ritchie Martori 86a85291ac Fix user test race condition 2014-01-23 14:39:15 -08:00
Ritchie Martori a43d6004c1 Fix race condition where MyEmail model was not attached to the correct dataSource in tests 2014-01-23 14:25:54 -08:00
Raymond Feng a6ff22c9c1 Make sure defaultPermission is checked 2014-01-16 15:05:10 -08:00
Raymond Feng c8eb5d9170 Make sure methods are called in the context of the calling class 2014-01-14 15:34:44 -08:00
Miroslav Bajtoš 1f80164e69 Merge pull request #135 from strongloop/feature/speed-up-user-passwords
Speed up tests accessing User.password
2014-01-13 22:04:41 -08:00
Miroslav Bajtoš 809411c103 Speed up tests accessing User.password
Decrease User.settings.saltWorkFactor in order to speed up unit-tests.
2014-01-13 20:05:22 +01:00
Miroslav Bajtoš ed81bdb6b8 Implement app.installMiddleware
The implementation is mostly a copy of
    loopback-workspace/templates/app.js
2014-01-13 17:26:24 +01:00
Miroslav Bajtoš 914ac2dcc9 Implement `app.listen`
The method starts a http server on the host & port configured
in the app config.
2014-01-13 09:12:54 +01:00
Miroslav Bajtoš 92896a441c Add app.restApiRoot setting
Allow loopback users to configure API root via config file, instead of
editing app.js generated by loopback-workspace.

Allow loopback plugins to discover the path where the REST adapter is
mounted.
2014-01-07 16:05:48 +01:00
Miroslav Bajtoš 78f514a003 Add ValidationError to loopback exports.
Simplify the construction of validation errors in user-land code:

    var error = new loopback.ValidationError(invalidModel);
2014-01-02 10:35:17 +01:00
Ritchie Martori 7b826e7c9e Add e2e tests for relations 2013-12-20 19:15:23 -08:00
Ritchie Martori 981bdd4c81 app.boot() now loads the "boot" directory 2013-12-18 21:41:41 -08:00
Ritchie Martori 16b790a93a Merge pull request #102 from strongloop/fix/user
Various Fixes and Behavioral Changes to the User Model
2013-12-18 21:34:30 -08:00
Raymond Feng 40cd71c4c6 Clean up the test case 2013-12-18 12:28:58 -08:00
Raymond Feng 598b1e6b61 Reformat the code using 2 space identation 2013-12-18 11:49:09 -08:00
Raymond Feng 95ad3e8c04 Allow cert/key data to be shared by push/feedback 2013-12-18 10:58:34 -08:00
Ritchie Martori 9f2651578b fixup - Include accessToken in user logout tests 2013-12-17 21:34:30 -08:00
Ritchie Martori 98ed38302a Logout now automatically pulls the accessToken from the request 2013-12-17 21:22:05 -08:00
Ritchie Martori 939df463fe Fix tests depending on old behavior of default User ACLs 2013-12-17 21:10:05 -08:00
Ritchie Martori ea7c9216d7 App config settings are now available from app.get() 2013-12-11 19:31:16 -08:00
Raymond Feng 97dc0aa441 Refactor to the code use wrapper classes
Add AccessContext, Principal, and AccessRequest
Add debug information
2013-12-11 16:03:48 -08:00
Raymond Feng 178674ec9a Enhance getRoles() to support smart roles 2013-12-11 09:06:21 -08:00
Raymond Feng 82eeaeee6b Fix the algorithm for Role.isInRole and ACL.checkAccess 2013-12-10 23:33:57 -08:00
Ritchie Martori dfcb43e613 Allow requests without auth tokens 2013-12-10 15:57:55 -08:00
Ritchie Martori e7cc30ee03 Fix base class not being actual base class 2013-12-09 17:11:01 -08:00
Raymond Feng 7f51c28539 Fix the ACL resolution against rules by matching score 2013-12-09 15:26:53 -08:00
Ritchie Martori af2b8dd4ff Merge feature/password-reset 2013-12-06 17:35:14 -08:00
Ritchie Martori 216fee3015 Add access type checking 2013-12-06 17:04:47 -08:00
Ritchie 68ef03e944 SLA-725 support PORT and HOST environment for PaaS support 2013-12-05 20:00:09 -08:00
Raymond Feng 23add99f12 Fix the test assertion as the error message is changed. 2013-12-04 14:41:25 -08:00
Ritchie Martori 2f9403016c Initial auth implementation 2013-11-22 12:26:59 -08:00
Miroslav Bajtos cf541cb828 Add test for findById returning 404
The test verifies the remoting configuration of
loopback-datasource-juggler, ensuring that
`DataAccessObject.findById()` has `rest.before` handler
correctly set up.
2013-11-21 16:23:01 +01:00
Ritchie Martori e92c46a4e4 Add password reset 2013-11-20 14:20:47 -08:00
Raymond Feng 344c74297c Add unauthenticated role 2013-11-20 13:43:02 -08:00
Raymond Feng bee8a3b022 Add checkAccess for subject and token 2013-11-20 13:43:01 -08:00
Raymond Feng 2c7c5fc7ec Start to support smart roles such as owner 2013-11-20 13:43:01 -08:00
Ritchie Martori 3753c15b71 Merge pull request #71 from strongloop/feature/status-middleware
Add status middleware
2013-11-19 13:15:57 -08:00
Ritchie Martori fd7dd7e4a2 Add status middleware 2013-11-19 12:54:30 -08:00
Ritchie Martori 178e5dab30 Remove .attachTo() from tests 2013-11-19 11:02:43 -08:00
Ritchie Martori cb39ae7adb Debugging odd defineFK behavior 2013-11-19 10:29:02 -08:00
Ritchie Martori da0545bed6 Initial auto wiring for model dataSources 2013-11-18 16:13:40 -08:00
Raymond Feng 8381b05da1 Allows LDL level ACLs 2013-11-15 09:41:26 -08:00
Raymond Feng 9bc762c09c Update dependencies 2013-11-14 21:19:57 -08:00
Raymond Feng 8e679d0927 Fix the permission resolution 2013-11-14 21:19:57 -08:00
Raymond Feng 94f12d0fce Fix the permission check 2013-11-14 21:19:57 -08:00
Raymond Feng 660ef89755 Merge ScopeACL into ACL 2013-11-14 21:19:56 -08:00
Raymond Feng 0430cd2ae3 Add tests for isInRole and getRoles 2013-11-14 21:19:56 -08:00
Raymond Feng c3a1a85159 Add constants and more tests 2013-11-14 21:19:56 -08:00
Raymond Feng 48a0242711 Define the models/relations for ACL 2013-11-14 21:19:56 -08:00
Raymond Feng 67b934357b Start to build the ACL models 2013-11-14 21:19:56 -08:00
Ritchie Martori 1de2a40e88 Update AccessToken and User relationship
- Add created default
 - Default TTLs for user login access tokens
 - Break out User / AccessToken relationship
2013-11-14 19:41:29 -08:00
Ritchie Martori 1bb95607b9 Update session / token documentation 2013-11-14 15:42:37 -08:00
Ritchie Martori 64d8ff986b Add loopback.token() middleware 2013-11-14 13:01:47 -08:00
Ritchie 77a137eca6 Rename Session => AccessToken 2013-11-14 10:05:13 -08:00
Raymond Feng a00645dd83 Merge pull request #53 from strongloop/apns
Update Application model for the push notification
2013-11-06 11:50:56 -08:00
Ritchie Martori 30df6cb597 Code review fixes based on feedback from https://github.com/strongloop/loopback/pull/57 2013-11-04 14:07:26 -08:00
Ritchie Martori da5cb2c117 Add app.boot() 2013-10-29 14:44:44 -07:00
Ritchie Martori a3f1d8d944 Refactor email model into mail connector 2013-10-14 10:54:55 -07:00
Raymond Feng bfffd839a7 Update Application model for the push notification 2013-10-11 13:56:26 -07:00
Raymond Feng 757803f203 Fix the test as DAO now ignores undefined value for query 2013-10-11 13:40:08 -07:00
Raymond Feng 858ec8714d Fix the id and property access 2013-10-04 15:53:02 -07:00
Raymond Feng 041779ed81 Fix the test case 2013-08-28 10:39:01 -07:00
Raymond Feng e8ac3a960f Update the list of shared methods 2013-08-16 16:39:13 -07:00
Raymond Feng 53c65602d2 Use strong-task-emitter 2013-08-01 11:31:30 -07:00
Ritchie Martori 423b4f2157 Fix login query 2013-07-28 14:33:13 -07:00
Ritchie Martori 7f1e88e816 Implement required and update invlaid id schemas 2013-07-28 13:20:55 -07:00
Ritchie Martori 0f3ad00086 Remove auth middleware and passport until adding in acl and strategies 2013-07-28 10:11:29 -07:00
Ritchie Martori 89f65d792f Clean up log out methods 2013-07-28 10:08:06 -07:00
Ritchie 8a7086be5c Add root true to remote methods 2013-07-24 17:21:15 -07:00
Raymond Feng 89a2a377c4 Fix the test case 2013-07-23 12:59:40 -07:00
Raymond Feng da1cd6739b Add more docs and apis to application model 2013-07-22 11:15:02 -07:00
Raymond Feng 267f94c542 Add a deleteById test 2013-07-22 10:00:07 -07:00
Raymond Feng 836df227c6 Add more functions and tests for Application model 2013-07-18 11:44:25 -07:00
Ritchie a2308cbc1c Merge 0.9 into master 2013-07-17 14:08:14 -07:00
Ritchie Martori 0b5e0d4252 More cleanup for test/README.md 2013-07-16 13:46:33 -07:00
Ritchie Martori 253d42a8e8 Cleanup test markdown 2013-07-16 13:41:17 -07:00
Ritchie Martori cba94a23fc Add memory docs and test 2013-07-16 13:39:03 -07:00
Raymond Feng 1059a7b863 Add renamed files 2013-07-16 11:05:38 -07:00
Raymond Feng 2f773115fe rename asteroid to loopback 2013-07-16 11:02:06 -07:00
Raymond Feng a35d2b7365 rename asteroid to loopback 2013-07-16 10:42:47 -07:00
Ritchie Martori fbf0e35f1d Remove updateAttribute as remote method 2013-07-15 19:45:27 -07:00
Ritchie Martori 49da6f4249 Fix login bug. 2013-07-15 18:22:33 -07:00
Ritchie Martori aa8d1bb853 Added bcrypt for password hashing 2013-07-15 14:07:17 -07:00
Ritchie Martori acfaee2fb0 Remove data argument name from user tests 2013-07-15 10:56:42 -07:00
Ritchie Martori d9b5daba0e Validate uniqueness and format of User email. 2013-07-12 17:03:13 -07:00
Ritchie Martori 16617a3737 Add user.logout() sugar method and update logout docs 2013-07-12 16:10:15 -07:00
Ritchie Martori a09b527000 Create 64 byte session ids 2013-07-12 15:47:58 -07:00
Ritchie Martori 9a62c48cfc Tests README 2013-07-12 13:38:52 -07:00
Ritchie Martori 78457fbeaf Updated generated test docs 2013-07-12 12:53:38 -07:00