Commit Graph

640 Commits

Author SHA1 Message Date
Raymond Feng 21b8609ee2 Report error for User.confirm()
See https://github.com/strongloop/loopback/issues/377
2014-07-22 10:42:22 -07:00
Miroslav Bajtoš 070f3d9583 Merge pull request #392 from strongloop/feature/drop-swagger
Remove `app.docs()`
2014-07-22 19:41:42 +02:00
Raymond Feng 643293cc25 Set up the base model based on the connector types 2014-07-22 10:38:14 -07:00
Miroslav Bajtoš bba58a73d5 express-middleware: improve error message
Include the flag `--save` in the npm instructions, so that the missing
module is both installed and saved in package dependencies.
2014-07-22 15:40:36 +02:00
Miroslav Bajtoš c7bca9da78 Remove `app.docs()`
The swagger integration was moved to loopback-explorer.
2014-07-22 15:08:23 +02: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 4f7a9869e0 Add descriptions for custom methods on user model 2014-07-18 22:48:07 -07:00
Raymond Feng 30c35ca5ef Move remoting metadata from juggler to loopback 2014-07-16 16:35:43 -07:00
Raymond Feng e5b64c6143 Upgrade to nodemailer 1.0.1 2014-07-16 12:40:15 -07:00
Raymond Feng 4e1d8c9a4e Merge branch '1.x' into 2.0 2014-07-16 11:06:24 -07:00
Raymond Feng a28e5b5897 Enhance the error message 2014-07-16 11:04:23 -07:00
Raymond Feng 79f504a3c7 Merge branch 'master' into 2.0 2014-07-16 09:09:07 -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
Miroslav Bajtoš da9b724222 lib/application: publish Change models to REST API
When a public model is added to an application and the model has change
tracking enabled, its Change model is added to the public models.

Before this change, conflict resolution in the browser was not working,
because it was not possible to fetch the remote change.
2014-07-15 09:31:16 +02:00
Miroslav Bajtoš 087c602669 models/change: fix typo 2014-07-15 09:14:54 +02:00
Raymond Feng 22e929e439 Fix credentials/challenges types
Associated identities and credentials are now captured by models in
loopback-component-passport. These two properties will be removed in
2.x.
2014-07-14 14:22:21 -07:00
crandmck b5c47dc7a5 Split out aliases for deleteById and destroyAll functions for jsdoc. 2014-07-11 15:41:14 -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 de831dbd33 Fix the typo 2014-07-08 08:54:13 -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 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
Aleksandr Tsertkov 476dd8214d Fix misleading token middleware documentation
Signed-off-by: Aleksandr Tsertkov <tsertkov@gmail.com>
2014-07-01 16:59:49 +02: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š 10d29c7d86 Merge branch 'master' into 2.0
Conflicts:
	package.json
2014-06-27 10:36:06 +02:00
Miroslav Bajtoš 45d026e7de Merge pull request #335 from karlmikko/bug/invalid-token-unhandled
Ignore unhanded error - simulate token missing
2014-06-27 09:56:17 +02:00
Guilherme Cirne 3fba6c50f0 Fix "ReferenceError: loopback is not defined" in registry.memory().
Signed-off-by: Guilherme Cirne <gcirne@gmail.com>
2014-06-26 10:40:28 -03: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
Karl Mikkelsen 46af483bdd Invalid Access Token return 401
Clean up logic to be easier to read.
Signed-off-by: Karl Mikkelsen <karl@karlmikko.com>
2014-06-26 08:50:41 +10:00
Raymond Feng 70c1cb5ce0 Update debug setting 2014-06-25 09:09:04 -07: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
Miroslav Bajtoš 70615696cd Mark `app.boot` as deprecated. 2014-06-25 13:44:07 +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
Samuel Reed afd8de0c31 Fix a slowdown caused by mutation of an incoming accessToken option. 2014-06-20 16:39:28 -05: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š 843e09342c lib/application: Remove forgotten `loopback` ref
Use `registry.Model` instead of `loopback.Model`.
2014-06-16 09:52:11 +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š 02d1c5e3c2 registry: export DataSource class
Expose the juggler's DataSource constructor as `loopback.DataSource`.

The DataSource constructor is most useful to check
for `instanceof DataSource`, but it also makes the loopback API more
consistent, since the API is already exposing all pre-built Models.
2014-06-12 10:41:45 +02:00
Miroslav Bajtoš f05291ca93 registry: fix non-unique default dataSources
Fix the problem where `registry.defaultDataSources` has two instances:

 - `require('loopback').defaultDataSources` used by
   `loopback.autoAttach()`

 - `require('./registry').defaultDataSources` used by
   `app.dataSource`.

I am intentionally leaving out unit-tests as the whole `autoAttach`
feature is going to be deleted before 2.0 is released.
2014-06-12 10:41:45 +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š 7cd6e09790 lib/registry fix jsdoc comments
Add missing names.
2014-06-12 10:41:44 +02:00
Miroslav Bajtoš 7d674779e1 refactor: extract runtime and registry
Move isBrowser and isServer from lib/loopback to a new file lib/runtime.

Move all Model and DataSource related methods like `createModel` and
`createDataSource` to lib/registry.

Remove the circular dependency between lib/application and lib/loopback,
by loading lib/registry and/or lib/runtime instead of lib/loopback
where appropriate

This commit is only moving the code around, the functionality should
not be changed at all.
2014-06-12 10:41:44 +02:00
Miroslav Bajtoš 19425b8fd9 Remove assertIsModel and isDataSource
Use `instanceof` operator instead:

  ModelCtor.prototype instanceof loopback.Model
  dataSource instanceof loopback.DataSource
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š 4259a3862a Make app.get/app.set available in browser
Implement settings object and methods in browser-express.
2014-06-12 10:40:36 +02:00
crandmck ad347e517c JSDoc fixes 2014-06-11 14:55:47 -07:00
Raymond Feng 6490447fac Set the role id to be generated
See https://github.com/strongloop/loopback-connector-postgresql/issues/5
2014-06-10 16:38:37 -07:00
Miroslav Bajtoš b576639d90 Add loopback.version back
Add `loopback.version` that was accidentaly removed by #308.
2014-06-10 11:19:36 +02: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
crandmck 6af69e322a JSDoc cleanup 2014-06-09 15:50:04 -07:00
crandmck cea2d30928 Merge branch 'master' of github.com:strongloop/loopback 2014-06-09 15:42:07 -07:00
crandmck 1694ee2d83 JSDoc cleanup 2014-06-09 15:36:08 -07:00
Raymond Feng 854402acba Merge pull request #314 from strongloop/feature/allow-custom-token-creation
Allow the creation of access token to be overriden
2014-06-09 15:01:15 -07:00
Raymond Feng a6ff4b0cad Use constructor to reference the model class 2014-06-09 15:00:15 -07:00
Raymond Feng 6b4ebdf609 Allow the creation of access token to be overriden 2014-06-09 14:53:55 -07:00
Miroslav Bajtoš a90e24c013 registry: export DataSource class
Expose the juggler's DataSource constructor as `loopback.DataSource`.

The DataSource constructor is most useful to check
for `instanceof DataSource`, but it also makes the loopback API more
consistent, since the API is already exposing all pre-built Models.
2014-06-09 16:25:35 +02:00
Miroslav Bajtoš 09cc57c061 registry: fix non-unique default dataSources
Fix the problem where `registry.defaultDataSources` has two instances:

 - `require('loopback').defaultDataSources` used by
   `loopback.autoAttach()`

 - `require('./registry').defaultDataSources` used by
   `app.dataSource`.

I am intentionally leaving out unit-tests as the whole `autoAttach`
feature is going to be deleted before 2.0 is released.
2014-06-09 16:15:56 +02: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š 63843b41fc lib/registry fix jsdoc comments
Add missing names.
2014-06-09 07:46:32 +02:00
crandmck 1316676946 Fixup JSDocs; note: updateOrCreate function alias pulled out on separate line for docs 2014-06-06 17:17:37 -07:00
Miroslav Bajtoš eac231df99 refactor: extract runtime and registry
Move isBrowser and isServer from lib/loopback to a new file lib/runtime.

Move all Model and DataSource related methods like `createModel` and
`createDataSource` to lib/registry.

Remove the circular dependency between lib/application and lib/loopback,
by loading lib/registry and/or lib/runtime instead of lib/loopback
where appropriate

This commit is only moving the code around, the functionality should
not be changed at all.
2014-06-06 11:53:23 +02:00
Miroslav Bajtoš 1b11060991 Remove assertIsModel and isDataSource
Use `instanceof` operator instead:

  ModelCtor.prototype instanceof loopback.Model
  dataSource instanceof loopback.DataSource
2014-06-06 10:30:03 +02:00
Miroslav Bajtoš 51e977de9b lib/loopback: fix jsdoc comments
Use
     @property {Object} [properties]
instead of
     @property {Object=} properties
for optional properties.

Use `**example**` instead of `@example`, since strong-docs don't support
the latter.
2014-06-06 10:28:21 +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
crandmck d8c6f9d962 Update JSDoc 2014-06-04 17:42:18 -07: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
Miroslav Bajtoš 88a4bb462e Exclude express-middleware from browser bundle
Fix lib/loopback to include express-middleware only on the server.

Bump up strong-remoting dependency to use the version working in
browsers.
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 bb0ddb26ec Rename express-wrapper to express-middleware 2014-05-29 10:18:58 -07:00
Raymond Feng 49380e490f Upgrade to Express 4.x 2014-05-29 08:44:05 -07:00
Miroslav Bajtoš 566757ba1d Deprecate app.boot, remove app.installMiddleware
The bootloader has its own project `loopback-boot` now.
2014-05-29 08:38:39 +02:00
Miroslav Bajtoš 18fd61a546 Merge branch 'master' into 2.0 2014-05-28 18:41:36 +02:00
Miroslav Bajtoš acf7af0c4e Merge pull request #287 from strongloop/feature/connector-registry
app: implement `connector()` and `connectors`
2014-05-28 17:01:24 +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š d0c87d3420 Merge pull request #285 from STRML/fixRestApiRootTypo
Fix a typo in `app.boot` caused by the change from restBasePath to restApiRoot.
2014-05-28 14:56:46 +02:00
Samuel Reed e625028486 Fix a typo in `app.boot`.
This typo was caused by the change from restBasePath to restApiRoot.

Signed-off-by: Samuel Reed <sam@tixelated.com>
2014-05-28 17:25:41 +08: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
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 d237ae5ddb Merge latest from master 2014-05-20 14:31:09 -07:00
Ritchie Martori 1a8ba602cc !fixup Mark DAO methods as delegate
Allow juggler to mix in these methods.
2014-05-20 13:45:47 -07:00
Ritchie Martori 77bd77e625 Ensure changes are created in sync 2014-05-20 12:46:43 -07:00
Ritchie Martori 52eb72d94f Remove un-rectify-able changes 2014-05-20 12:14:51 -07:00
Ritchie Martori 2de33d4da5 Rework change conflict detection 2014-05-19 19:54:55 -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 558ea60da0 In progress: rework remoting meta-data 2014-05-16 12:32:54 -07:00
Adam Schwartz 7c00119292 Fix typo "Unkown" => "Unknown" 2014-05-15 23:32:12 -04:00
Ritchie Martori 2f21f4ec1e Rework replication test 2014-05-15 17:30:58 -07:00
Ritchie Martori 1e2ad9fba9 Change#getModel(), Doc cleanup, Conflict event 2014-05-14 09:20:04 -07:00
Ritchie Martori 4bab42478f Add error logging for missing data 2014-05-12 10:36:10 -07:00
haio 978bc57421 Fix bug in User#resetPassword 2014-05-10 15:43:01 +08:00
Ritchie Martori 908221416e Fix issues when using MongoDB for replication 2014-05-09 17:19:32 -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
haio 429052a0db Ensure roleId and principalId to be string in Role#isInRole 2014-05-03 11:43:03 +08:00
Ritchie Martori 012f880078 !fixup RemoteConnector tests 2014-05-02 20:04:06 -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 69cd6a836b !fixup .replicate() argument handling 2014-04-29 20:40:00 -07:00
Ritchie Martori e35309ba27 Fixes for e2e replication / remote connector tests 2014-04-29 17:17:49 -07:00
haio eae86b64f4 typo 2014-04-29 20:10:44 +08:00
haio f44d737e7e Add more check on principalId 2014-04-29 09:34:48 +08:00
haio aa63d7bf4b Convert principalId to String 2014-04-28 21:36:44 +08:00
Raymond Feng b57c998ce2 Merge pull request #242 from strongloop/feature/fix-issue-239
Rename the method so that it won't conflict with Model.checkAccess
2014-04-24 10:27:18 -07:00
crandmck 1676ac6e58 Fix constructor JSDoc 2014-04-23 15:20:18 -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 13b18065e2 Documentation cleanup 2014-04-14 14:49:29 -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
Alex Pica 1c1364636d Fix #229 (Whitespaces removed 2014-04-10 06:01:58 +03:00
Miroslav Bajtoš e8971fde41 Merge pull request #223 from strongloop/feature/improve-sharedctor-description
Describe the "id" parameter of model's sharedCtor
2014-04-04 07:36:03 -07:00
crandmck dff182ed27 Clean up JSDoc comments. Remove doc for deprecated installMiddleware function 2014-04-03 11:29:00 -07:00
Miroslav Bajtoš 4c246c7f2c Describe the "id" parameter of model's sharedCtor
Extend remoting metadata to describe the "id" parameter accepted
by the sharedCtor of all models.
2014-04-03 10:39:42 +02:00
crandmck 006aca6b9c Update and cleanup JSDoc 2014-04-02 15:46:39 -07:00
crandmck a265d67007 Cleanup and update of jsdoc 2014-04-02 15:15:21 -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 51d3ff892a Merge pull request #219 from dougtoppin/fix-verify-confirm
Fix verify confirm
2014-03-31 12:02:48 -07:00
Doug Toppin 8b71c3022d Update user.js
Corrected spacing on confirm ACL, removed extraneous comment on using hex rather than base64
2014-03-30 08:02:19 -04:00
Ritchie Martori a08b047fab Add hidden property documentation 2014-03-27 15:25:37 -07:00
Ritchie Martori 4c185e5453 Support host / port in Remote connector 2014-03-27 14:47:30 -07:00
Ritchie Martori ac2206d257 Throw useful errors in DataModel stub methods 2014-03-27 14:47:29 -07:00
Ritchie Martori 64b374907a Move proxy creation from remote connector into base model class 2014-03-27 14:47:29 -07:00
Ritchie Martori 0632f52411 Remove reload method body 2014-03-27 14:47:29 -07:00
Ritchie Martori dcdbef861e Add Remote connector 2014-03-27 14:47:29 -07:00
Ritchie Martori ef7b724375 Initial client-server example 2014-03-27 14:47:29 -07:00
Doug Toppin e52dbe2fb5 fix to enable ACL for confirm link sent by email 2014-03-23 21:06:22 -04: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 aaaa28d569 Add more comments 2014-03-19 16:24:50 -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
Raymond Feng 32a9131004 Pause the req before checking access
See https://github.com/strongloop/loopback-storage-service/issues/7
2014-03-17 14:40:05 -07: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
crandmck c80b334130 Improvements to JSDoc comments 2014-03-14 10:28:31 -07:00
crandmck 9fb3f3313a Fixes to JSDoc for API docs 2014-03-13 17:25:21 -07:00
Raymond Feng 533daf4040 Remove oauth2 models as they will be packaged in a separate module 2014-03-11 22:37:54 -07:00
Ritchie Martori 57ff242308 Minor doc fix 2014-03-10 18:05:44 -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
Doug Toppin 42c9777de3 using base64 caused an occasional token string to contain '+' which resulted in a space being embedded in the token. 'hex' should always produce a url safe string for the token. 2014-02-25 22:14:32 -05:00
Doug Toppin 2f301e315a Sending email was missing the from field 2014-02-23 21:08:13 -05: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
Raymond Feng 37646fa008 Allows options to be passed to strong-remoting 2014-02-19 15:14:31 -08:00
Ryan Graham 088c2e2296 Merge fixup 2014-02-19 14:11:16 -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
Guilherme Cirne b466bb96c8 The simplest possible solution for clearing the handler cache when registering a model. 2014-02-18 17:40:35 -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
Aurelien Chivot c216ba03c1 Documentation (generated) fix 2014-02-11 19:14:04 +01: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 867e3ca996 fixup! Assert model exists 2014-02-05 15:32:38 -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
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 ab8d1ae109 Add replication example 2014-01-30 14:20:34 -08:00
Ritchie Martori e3d80058dc Add Checkpoint model and Model replication methods 2014-01-30 14:20:34 -08:00
Ritchie Martori cc49d675ce Add Change model 2014-01-30 14:20:33 -08:00
Miroslav Bajtoš c36e20587e Merge pull request #163 from strongloop/feature/include-user-in-login-result
Include user in login result
2014-01-30 10:24:14 -08:00
Raymond Feng c711b99b8a Merge pull request #154 from strongloop/feature/debug-login-error
Add debug information for user.login
2014-01-30 10:13:26 -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
Miroslav Bajtoš 03cb2f0556 Describe `access_token` param of `User.logout`
Add an explicit note that clients are not supposed to send the
`access_token` parameter, since it is extracted from request
headers.
2014-01-30 18:09:54 +01:00
Raymond Feng 57796a41cd Remove the generated flag for access token id
The generated flag is used to indicate if the id is automatically generated
by the backend store. If it's set, the data type will be updated when the
model is attached to a datasource.

The AccessToken model defines a string id, which is set in the beforeCreate
hook. So it's client provided id.
2014-01-30 09:02:12 -08:00
Ritchie Martori a0e595dce8 Add model tests 2014-01-28 14:46:16 -08:00
Ritchie Martori 2582c3fc65 Add replication example 2014-01-28 12:54:41 -08:00
Raymond Feng 938cafeb77 Remove message prefix as debug will print it 2014-01-27 14:47:48 -08:00
Raymond Feng c35f762d4e Add debug information for user.login 2014-01-27 14:31:38 -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
Miroslav Bajtoš 8bb8861ba1 Register exported models using singular names
Remove the inconsistency between model names used by LoopBack app and
datasource-juggler (modelName, e.g. User) and the name used by
strong-remoting (pluralModelName, e.g. Users).

This way the class name in the strong-remoting metadata can be used
by client-code generators. Before this change, the generators would
produce method names like `Users.login`.
2014-01-27 10:29:57 +01:00
Miroslav Bajtoš 54bff35fef User: use User.http.path
Use the new property introduced by a recent change in
loopback-datasource-juggler instead of building the URL
manually from pluralModelName.
2014-01-27 10:29:57 +01:00
Ritchie Martori 1a13a8d95e Add Checkpoint model and Model replication methods 2014-01-26 14:02:56 -08:00
Ritchie Martori 4be3395298 Add Change model 2014-01-26 13:20:19 -08:00
Raymond Feng 5586c54c49 Fix the Role ref to RoleMapping 2014-01-23 15:04:48 -08:00
Raymond Feng 224b500c3a Fix the Scope reference to models 2014-01-23 14:46:02 -08:00
Raymond Feng bb389ce209 Lookup the email model 2014-01-23 14:40:27 -08:00
Raymond Feng bcc7e68e0e Add lookback.getModelByType() and use it resolve model deps 2014-01-23 14:39:27 -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 d6a4230aed Fix the method args 2014-01-21 16:41:48 -08:00
Raymond Feng a5242a3b77 Fix the typo for the method name 2014-01-21 16:35:28 -08:00
Raymond Feng 8a114c635f Prevent autoAttach from overriding existing data source 2014-01-20 14:32:47 -08:00
Raymond Feng 5a6155e08e Clean up loopback.js doc and add it to docs.json 2014-01-17 10:40:41 -08:00
Raymond Feng 32bdce53ee Fix the jsdoc for loopback.getModel() 2014-01-17 10:23:59 -08:00
Raymond Feng a6ff22c9c1 Make sure defaultPermission is checked 2014-01-16 15:05:10 -08:00
Raymond Feng 7212ebe805 Remove the dangling require 2014-01-16 09:12:52 -08:00
Raymond Feng d8647bb3c1 Make ACL model subclassing friendly 2014-01-16 08:50:50 -08:00
Miroslav Bajtoš e6cdeb5cd4 Improve jsdox documentation of app object
Remove docs/api-app.md and docs/api.md, as they are no longer referenced
from docs.json.

Add few missing bits from docs/api-app.md to lib/application.js
comments.
2014-01-15 08:44:49 +01:00
Raymond Feng c8eb5d9170 Make sure methods are called in the context of the calling class 2014-01-14 15:34:44 -08:00
Ritchie Martori 9fc8e197ee Start to move md to jsdoc 2014-01-14 10:03:47 -08:00
Miroslav Bajtoš 8573d01c16 Replace `on` with `once` in middleware examples
Fix the jsdox for `app.installMiddleware` to use `app.once` for
listening on 'middleware:*' events.

The previous doc version using `on` was a sort of preliminary
pessimisation, becase the event handlers would stay in the heap
for the whole life-time of the app, even though they won't be called
more than once.
2014-01-14 08:07:47 +01:00
Miroslav Bajtoš 57813cef56 Merge pull request #133 from strongloop/feature/app-install-middleware
Implement app.installMiddleware
2014-01-13 21:58:11 -08:00
Ritchie Martori 9668692406 Merge pull request #136 from strongloop/fix/mail-transports
Fix incorrect transports
2014-01-13 20:03:25 -08:00
Ritchie Martori 92eaa383f3 Fix incorrect transports 2014-01-13 19:04:21 -08:00
Ritchie Martori 45e5641055 Merge pull request #130 from strongloop/fix/mail-transports
Fix/mail transports
2014-01-13 18:36:42 -08: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
Ritchie Martori 80b4482c31 Provide sane default for email connector transports 2014-01-10 10:45:26 -08:00
Ritchie Martori 7e1810a1ad Add an empty transportsIndex to the mail connector by default 2014-01-10 10:18:21 -08:00
Ritchie Martori 6bb0ba2d95 Add missing assert in user model 2014-01-10 10:07:39 -08: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
Ritchie fcc4bba82d Add reference documentation using sdocs 2013-12-19 17:49:47 -08:00
Raymond Feng a47317de0d Update README for application model 2013-12-19 13:42:12 -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 ac2f4de9d3 Remove the default values for gateway/port 2013-12-18 12:28:48 -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 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 3152960336 Add default user ACLs 2013-12-17 20:42:28 -08:00
Miroslav Bajtoš d09e3225cd Define schema for GCM push-notification settings
Remove unused property PushNotificationSettingSchema.platform.

Flatten GCM settings schema. There is no need to distinquish between
pushOptions and feedback, as there is only single HTTP channel shared
by both.
2013-12-17 18:44:13 +01:00
Ritchie Martori 0794f141c1 Improve debug statements for access control 2013-12-16 18:12:13 -08:00
Ritchie Martori 5a154072a1 Merge pull request #96 from strongloop/feature/config
Make all app config values available from `app.get()`
2013-12-12 16:01:43 -08:00
Ritchie Martori 591ed86444 Merge pull request #97 from strongloop/bug/check-access
Dont attempt access checking on models without a check access method
2013-12-12 16:01:33 -08:00
Ritchie Martori 4619a143f5 Dont attempt access checking on models without a check access method 2013-12-11 19:46:56 -08:00
Ritchie Martori ea7c9216d7 App config settings are now available from app.get() 2013-12-11 19:31:16 -08:00
Ritchie Martori b62b8fa47d Fix user not allowed to delete itself if user
**Note: the only code required for the fix is in role.js:203**. The
other changes are to help organize debug output.
2013-12-11 19:15:19 -08:00
Ritchie Martori ad58a8ec13 Only look at cookies if they are available 2013-12-11 16:43:23 -08:00
Raymond Feng 0f86f69880 Remove the empty comment and set default token 2013-12-11 16:21:37 -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 4560ec0964 Various ACL fixes 2013-12-10 21:49:18 -08:00
Ritchie Martori b0f51e20f7 Add user default ACLs 2013-12-10 19:43:59 -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 Martori bc27f07472 Add Model.requireToken for disabling token requirement 2013-12-06 12:09:52 -08:00
Ritchie Martori 4c69af5ae2 Add Model.requireToken, default swagger to false 2013-12-06 12:00:18 -08:00
Ritchie 68ef03e944 SLA-725 support PORT and HOST environment for PaaS support 2013-12-05 20:00:09 -08:00
Ritchie Martori 0987adfd5f Merge pull request #64 from strongloop/auth
Initial auth implementation
2013-12-02 17:20:42 -08:00
Ritchie Martori 5cd71cee6b Use loopback.AccessToken as default 2013-12-02 17:16:43 -08:00
Ritchie Martori 2c36935404 Fix missing assert 2013-12-02 16:37:42 -08:00
Ritchie Martori 2f9403016c Initial auth implementation 2013-11-22 12:26:59 -08:00
Raymond Feng 52b1588152 Merge pull request #74 from strongloop/acl
More ACL features
2013-11-20 14:30:40 -08:00
Ritchie Martori e92c46a4e4 Add password reset 2013-11-20 14:20:47 -08:00
Ritchie Martori aaa8423257 Fix minor autoWiring bugs 2013-11-20 14:18:54 -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 e5a55846e8 Merge pull request #69 from strongloop/datasource-auto-wiring
Initial auto wiring for model dataSources
2013-11-19 13:11:54 -08:00
Ritchie Martori fd7dd7e4a2 Add status middleware 2013-11-19 12:54:30 -08:00
Ritchie Martori 9db8a7a25f Auto attach all models created 2013-11-19 12:23:02 -08:00
Miroslav Bajtos 7d60b2dea6 Add loopback.urlNotFound() middleware.
The middleware should be used as the last 3-parameter middleware (regular
request handles) before any 4-parameter middleware (error handlers).

This way a request to an URL not handled by any middleware is converted to
a 404 error that can be handled by whatever error handling strategy is
configured in the application.

See senchalabs/connect#954 for more details.
2013-11-19 20:27:49 +01:00
Ritchie Martori 178e5dab30 Remove .attachTo() from tests 2013-11-19 11:02:43 -08:00
Ritchie Martori da0545bed6 Initial auto wiring for model dataSources 2013-11-18 16:13:40 -08:00
Ritchie Martori ec58237f8a Add public flag checking 2013-11-18 12:52:00 -08:00
Raymond Feng 9fddbc3834 Switch to modelBuilder 2013-11-15 11:16:20 -08:00
Raymond Feng 44dfe34647 Allow ACLs for methods/relations 2013-11-15 10:08:49 -08:00
Raymond Feng 8381b05da1 Allows LDL level ACLs 2013-11-15 09:41:26 -08:00
Raymond Feng 8e679d0927 Fix the permission resolution 2013-11-14 21:19:57 -08:00
Raymond Feng cc7560b258 Simplify check permission 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 be3c40c3d3 Add oauth2 related models 2013-11-14 21:19:56 -08:00
Raymond Feng be32341467 Add a stub to register role resolvers 2013-11-14 21:19:56 -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
Raymond Feng 492aca7724 Update acl/role models 2013-11-14 21:19:56 -08:00
Raymond Feng f9849454e9 Update ACL model 2013-11-14 21:19:09 -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 efce5039f6 Added AccessToken created property 2013-11-14 16:47:24 -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
Ritchie Martori 77e842d2a3 Fix bundle model name casing 2013-11-11 13:35:54 -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 04a2de9f35 Merge pull request #58 from strongloop/lb-1.2-project
1.2 app.boot()
2013-11-05 14:08:21 -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 1e3bfc6c18 Automatically convert strings to connectors if they are LoopBack connectors 2013-11-01 12:53:30 -07:00
Ritchie 6179476030 Add app.dataSource() method 2013-10-31 10:06:43 -07:00
Ritchie Martori da5cb2c117 Add app.boot() 2013-10-29 14:44:44 -07:00
Raymond Feng 71339e159e Remove the proxy as it is now handled by the juggler 2013-10-24 20:40:33 -07:00
Raymond Feng e5a28b96ac Clean up the model 2013-10-23 13:25:50 -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