@vsaas/loopback 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +25 -0
- package/README.md +91 -0
- package/common/models/README.md +109 -0
- package/common/models/access-token.json +37 -0
- package/common/models/acl.json +17 -0
- package/common/models/application.json +130 -0
- package/common/models/change.json +25 -0
- package/common/models/checkpoint.json +14 -0
- package/common/models/email.json +11 -0
- package/common/models/key-value-model.json +4 -0
- package/common/models/role-mapping.json +26 -0
- package/common/models/role.json +30 -0
- package/common/models/scope.json +14 -0
- package/common/models/user.json +118 -0
- package/dist/_virtual/_rolldown/runtime.cjs +32 -0
- package/dist/common/models/access-token.cjs +144 -0
- package/dist/common/models/access-token2.cjs +43 -0
- package/dist/common/models/acl.cjs +428 -0
- package/dist/common/models/acl2.cjs +27 -0
- package/dist/common/models/application.cjs +100 -0
- package/dist/common/models/application2.cjs +118 -0
- package/dist/common/models/change.cjs +404 -0
- package/dist/common/models/change2.cjs +25 -0
- package/dist/common/models/checkpoint.cjs +43 -0
- package/dist/common/models/checkpoint2.cjs +18 -0
- package/dist/common/models/email.cjs +18 -0
- package/dist/common/models/email2.cjs +30 -0
- package/dist/common/models/key-value-model.cjs +140 -0
- package/dist/common/models/key-value-model2.cjs +14 -0
- package/dist/common/models/role-mapping.cjs +57 -0
- package/dist/common/models/role-mapping2.cjs +34 -0
- package/dist/common/models/role.cjs +396 -0
- package/dist/common/models/role2.cjs +38 -0
- package/dist/common/models/scope.cjs +30 -0
- package/dist/common/models/scope2.cjs +21 -0
- package/dist/common/models/user.cjs +810 -0
- package/dist/common/models/user2.cjs +118 -0
- package/dist/index.cjs +16 -0
- package/dist/lib/access-context.cjs +228 -0
- package/dist/lib/application.cjs +450 -0
- package/dist/lib/builtin-models.cjs +60 -0
- package/dist/lib/configure-shared-methods.cjs +41 -0
- package/dist/lib/connectors/base-connector.cjs +23 -0
- package/dist/lib/connectors/mail-direct-transport.cjs +375 -0
- package/dist/lib/connectors/mail-stub-transport.cjs +86 -0
- package/dist/lib/connectors/mail.cjs +128 -0
- package/dist/lib/connectors/memory.cjs +19 -0
- package/dist/lib/current-context.cjs +22 -0
- package/dist/lib/globalize.cjs +29 -0
- package/dist/lib/loopback.cjs +313 -0
- package/dist/lib/model.cjs +1009 -0
- package/dist/lib/persisted-model.cjs +1835 -0
- package/dist/lib/registry.cjs +291 -0
- package/dist/lib/runtime.cjs +25 -0
- package/dist/lib/server-app.cjs +231 -0
- package/dist/lib/utils.cjs +154 -0
- package/dist/package.cjs +124 -0
- package/dist/server/middleware/context.cjs +7 -0
- package/dist/server/middleware/error-handler.cjs +6 -0
- package/dist/server/middleware/favicon.cjs +13 -0
- package/dist/server/middleware/rest.cjs +44 -0
- package/dist/server/middleware/static.cjs +14 -0
- package/dist/server/middleware/status.cjs +28 -0
- package/dist/server/middleware/token.cjs +66 -0
- package/dist/server/middleware/url-not-found.cjs +20 -0
- package/favicon.ico +0 -0
- package/package.json +121 -0
- package/templates/reset-form.ejs +3 -0
- package/templates/verify.ejs +9 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Copyright (c) IBM Corp. 2013,2018. All Rights Reserved.
|
|
2
|
+
Node module: loopback
|
|
3
|
+
This project is licensed under the MIT License, full text below.
|
|
4
|
+
|
|
5
|
+
--------
|
|
6
|
+
|
|
7
|
+
MIT license
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in
|
|
17
|
+
all copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# @vsaas/loopback
|
|
2
|
+
|
|
3
|
+
`@vsaas/loopback` is a fork of `loopback` focused on keeping LoopBack 3 style applications running while reducing maintenance overhead.
|
|
4
|
+
|
|
5
|
+
The goal of this fork is practical compatibility for the common upstream use cases, not byte-for-byte preservation of the original package. The internals were intentionally simplified and modernized:
|
|
6
|
+
|
|
7
|
+
- TypeScript source with build output in `dist/`
|
|
8
|
+
- English-only messages
|
|
9
|
+
- no i18n catalogs or `strong-globalize`
|
|
10
|
+
- no legacy browser bundling surface
|
|
11
|
+
- public legacy subpaths preserved through `exports` even though the old root `.js` wrappers were removed
|
|
12
|
+
- modern tooling with `tsdown`, `vitest`, and `oxlint`
|
|
13
|
+
- callback-compatible APIs that continue to work with `Promise` and `async/await`
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm install @vsaas/loopback
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
If you are also using the related forks, pair it with `@vsaas/loopback-boot`, `@vsaas/loopback-datasource-juggler`, and `@vsaas/remoting`.
|
|
22
|
+
|
|
23
|
+
## Quick start
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
const loopback = require('@vsaas/loopback');
|
|
27
|
+
|
|
28
|
+
const app = loopback();
|
|
29
|
+
|
|
30
|
+
app.dataSource('db', {
|
|
31
|
+
connector: 'memory',
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const Product = app.registry.createModel('Product', {
|
|
35
|
+
name: String,
|
|
36
|
+
price: Number,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
app.model(Product, {
|
|
40
|
+
dataSource: 'db',
|
|
41
|
+
public: true,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
app.use('/api', loopback.rest());
|
|
45
|
+
app.listen(3000);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Scope
|
|
49
|
+
|
|
50
|
+
This package still provides the main building blocks existing `loopback` users expect:
|
|
51
|
+
|
|
52
|
+
- the LoopBack application factory and Express integration
|
|
53
|
+
- built-in models such as `User`, `AccessToken`, `ACL`, `Role`, and `Application`
|
|
54
|
+
- registry, datasource, and model wiring on top of `@vsaas/loopback-datasource-juggler`
|
|
55
|
+
- REST middleware and remoting integration used by LoopBack 3 applications
|
|
56
|
+
- compatibility with `loopback-boot` application layouts and convention-based model loading
|
|
57
|
+
|
|
58
|
+
If you are migrating an existing codebase, the intent is that the public API should feel familiar even though the implementation is leaner.
|
|
59
|
+
|
|
60
|
+
## Supported Surface
|
|
61
|
+
|
|
62
|
+
The supported application-facing surface intentionally includes:
|
|
63
|
+
|
|
64
|
+
- the main entrypoint: `require('@vsaas/loopback')`
|
|
65
|
+
- application creation via `loopback()`
|
|
66
|
+
- middleware exports such as `loopback.rest()`, `loopback.static()`, `loopback.token()`, `loopback.status()`, `loopback.urlNotFound()`, and `loopback.favicon()`
|
|
67
|
+
- built-in models, registry helpers, and datasource helpers exposed from the main module
|
|
68
|
+
- package subpaths used by LoopBack 3 apps and boot scripts: `@vsaas/loopback/common/models/*.json`, `@vsaas/loopback/common/models/*.js`, `@vsaas/loopback/lib/*.js`, and `@vsaas/loopback/server/middleware/*.js`
|
|
69
|
+
|
|
70
|
+
Those legacy-looking `.js` subpaths are still supported for compatibility, but they now resolve to compiled files in `dist/` via `package.json` exports.
|
|
71
|
+
|
|
72
|
+
## Notes for Fork Users
|
|
73
|
+
|
|
74
|
+
- This is a maintained fork, not the upstream package.
|
|
75
|
+
- Messages are English-only by design.
|
|
76
|
+
- The old root runtime wrappers were removed as implementation details, but supported package entrypoints remain exported.
|
|
77
|
+
- Browser-specific packaging from upstream is not part of the maintained surface.
|
|
78
|
+
- The test entrypoint is `vitest`, while the large legacy suite still runs underneath for compatibility.
|
|
79
|
+
|
|
80
|
+
## Development
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm run build
|
|
84
|
+
npm run typecheck
|
|
85
|
+
npm run lint
|
|
86
|
+
npm test
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
MIT. See [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Application
|
|
2
|
+
|
|
3
|
+
Application model represents the metadata for a client application that has its
|
|
4
|
+
own identity and associated configuration with the LoopBack server.
|
|
5
|
+
|
|
6
|
+
## Each application has the following basic properties:
|
|
7
|
+
|
|
8
|
+
- id: Automatically generated id
|
|
9
|
+
- name: Name of the application (required)
|
|
10
|
+
- description: Description of the application (optional)
|
|
11
|
+
- icon: URL of the icon
|
|
12
|
+
- status: Status of the application, such as production/sandbox/disabled
|
|
13
|
+
- created: Timestamp of the record being created
|
|
14
|
+
- modified: Timestamp of the record being modified
|
|
15
|
+
|
|
16
|
+
## An application has the following properties linking to users:
|
|
17
|
+
|
|
18
|
+
- owner: The user id of the developer who registers the application
|
|
19
|
+
- collaborators: A array of users ids who have permissions to work on this app
|
|
20
|
+
|
|
21
|
+
## oAuth 2.0 settings
|
|
22
|
+
|
|
23
|
+
- url: The application url
|
|
24
|
+
- callbackUrls: An array of preregistered callback urls for oAuth 2.0
|
|
25
|
+
- permissions: An array of oAuth 2.0 scopes that can be requested by the application
|
|
26
|
+
|
|
27
|
+
## Security keys
|
|
28
|
+
|
|
29
|
+
The following keys are automatically generated by the application creation
|
|
30
|
+
process. They can be reset upon request.
|
|
31
|
+
|
|
32
|
+
- clientKey: Secret for mobile clients
|
|
33
|
+
- javaScriptKey: Secret for JavaScript clients
|
|
34
|
+
- restApiKey: Secret for REST APIs
|
|
35
|
+
- windowsKey: Secret for Windows applications
|
|
36
|
+
- masterKey: Secret for REST APIS. It bypasses model level permissions
|
|
37
|
+
|
|
38
|
+
## Push notification settings
|
|
39
|
+
|
|
40
|
+
The application can be configured to support multiple methods of push notifications.
|
|
41
|
+
|
|
42
|
+
- pushSettings
|
|
43
|
+
|
|
44
|
+
pushSettings: {
|
|
45
|
+
apns: {
|
|
46
|
+
certData: config.apnsCertData,
|
|
47
|
+
keyData: config.apnsKeyData,
|
|
48
|
+
production: false, // Development mode
|
|
49
|
+
pushOptions: {
|
|
50
|
+
// Extra options can go here for APN
|
|
51
|
+
},
|
|
52
|
+
feedbackOptions: {
|
|
53
|
+
batchFeedback: true,
|
|
54
|
+
interval: 300
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
gcm: {
|
|
58
|
+
serverApiKey: config.gcmServerApiKey
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
## Authentication schemes
|
|
63
|
+
|
|
64
|
+
- authenticationEnabled
|
|
65
|
+
- anonymousAllowed
|
|
66
|
+
- authenticationSchemes
|
|
67
|
+
|
|
68
|
+
### Authentication scheme settings
|
|
69
|
+
|
|
70
|
+
- scheme: Name of the authentication scheme, such as local, facebook, google,
|
|
71
|
+
twitter, linkedin, github
|
|
72
|
+
- credential: Scheme-specific credentials
|
|
73
|
+
|
|
74
|
+
## APIs for Application model
|
|
75
|
+
|
|
76
|
+
In addition to the CRUD methods, the Application model also has the following
|
|
77
|
+
apis:
|
|
78
|
+
|
|
79
|
+
### Register a new application
|
|
80
|
+
|
|
81
|
+
You can register a new application by providing the owner user id, application
|
|
82
|
+
name, and other properties in the options object.
|
|
83
|
+
|
|
84
|
+
Application.register('rfeng', 'MyApp1',
|
|
85
|
+
{description: 'My first loopback application'},
|
|
86
|
+
function (err, result) {
|
|
87
|
+
var app = result;
|
|
88
|
+
...
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
### Reset keys
|
|
92
|
+
|
|
93
|
+
You can reset keys for a given application by id.
|
|
94
|
+
|
|
95
|
+
Application.resetKeys(appId, function (err, result) {
|
|
96
|
+
var app = result;
|
|
97
|
+
...
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
### Authenticate by appId and key
|
|
101
|
+
|
|
102
|
+
You can authenticate an application by id and one of the keys. If successful,
|
|
103
|
+
it calls back with the key name in the result argument. Otherwise, the
|
|
104
|
+
keyName is null.
|
|
105
|
+
|
|
106
|
+
Application.authenticate(appId, clientKey, function (err, keyName) {
|
|
107
|
+
assert.equal(keyName, 'clientKey');
|
|
108
|
+
...
|
|
109
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "AccessToken",
|
|
3
|
+
"properties": {
|
|
4
|
+
"id": {
|
|
5
|
+
"type": "string",
|
|
6
|
+
"id": true
|
|
7
|
+
},
|
|
8
|
+
"ttl": {
|
|
9
|
+
"type": "number",
|
|
10
|
+
"ttl": true,
|
|
11
|
+
"default": 1209600,
|
|
12
|
+
"description": "time to live in seconds (2 weeks by default)"
|
|
13
|
+
},
|
|
14
|
+
"scopes": {
|
|
15
|
+
"type": ["string"],
|
|
16
|
+
"description": "Array of scopes granted to this access token."
|
|
17
|
+
},
|
|
18
|
+
"created": {
|
|
19
|
+
"type": "Date",
|
|
20
|
+
"defaultFn": "now"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"relations": {
|
|
24
|
+
"user": {
|
|
25
|
+
"type": "belongsTo",
|
|
26
|
+
"model": "User",
|
|
27
|
+
"foreignKey": "userId"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"acls": [
|
|
31
|
+
{
|
|
32
|
+
"principalType": "ROLE",
|
|
33
|
+
"principalId": "$everyone",
|
|
34
|
+
"permission": "DENY"
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ACL",
|
|
3
|
+
"properties": {
|
|
4
|
+
"model": {
|
|
5
|
+
"type": "string",
|
|
6
|
+
"description": "The name of the model"
|
|
7
|
+
},
|
|
8
|
+
"property": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The name of the property, method, scope, or relation"
|
|
11
|
+
},
|
|
12
|
+
"accessType": "string",
|
|
13
|
+
"permission": "string",
|
|
14
|
+
"principalType": "string",
|
|
15
|
+
"principalId": "string"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Application",
|
|
3
|
+
"properties": {
|
|
4
|
+
"id": {
|
|
5
|
+
"type": "string",
|
|
6
|
+
"id": true
|
|
7
|
+
},
|
|
8
|
+
"realm": {
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"name": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"required": true
|
|
14
|
+
},
|
|
15
|
+
"description": "string",
|
|
16
|
+
"icon": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "The icon image url"
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
"owner": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "The user id of the developer who registers the application"
|
|
24
|
+
},
|
|
25
|
+
"collaborators": {
|
|
26
|
+
"type": ["string"],
|
|
27
|
+
"description": "A list of users ids who have permissions to work on this app"
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
"email": "string",
|
|
31
|
+
"emailVerified": "boolean",
|
|
32
|
+
|
|
33
|
+
"url": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"description": "The application URL for OAuth 2.0"
|
|
36
|
+
},
|
|
37
|
+
"callbackUrls": {
|
|
38
|
+
"type": ["string"],
|
|
39
|
+
"description": "OAuth 2.0 code/token callback URLs"
|
|
40
|
+
},
|
|
41
|
+
"permissions": {
|
|
42
|
+
"type": ["string"],
|
|
43
|
+
"description": "A list of permissions required by the application"
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
"clientKey": "string",
|
|
47
|
+
"javaScriptKey": "string",
|
|
48
|
+
"restApiKey": "string",
|
|
49
|
+
"windowsKey": "string",
|
|
50
|
+
"masterKey": "string",
|
|
51
|
+
|
|
52
|
+
"pushSettings": {
|
|
53
|
+
"apns": {
|
|
54
|
+
"production": {
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"description": [
|
|
57
|
+
"Production or development mode. It denotes what default APNS",
|
|
58
|
+
"servers to be used to send notifications.",
|
|
59
|
+
"See API documentation for more details."
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
"certData": {
|
|
64
|
+
"type": "string",
|
|
65
|
+
"description": "The certificate data loaded from the cert.pem file"
|
|
66
|
+
},
|
|
67
|
+
"keyData": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"description": "The key data loaded from the key.pem file"
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
"pushOptions": {
|
|
73
|
+
"type": {
|
|
74
|
+
"gateway": "string",
|
|
75
|
+
"port": "number"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
"feedbackOptions": {
|
|
80
|
+
"type": {
|
|
81
|
+
"gateway": "string",
|
|
82
|
+
"port": "number",
|
|
83
|
+
"batchFeedback": "boolean",
|
|
84
|
+
"interval": "number"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
"gcm": {
|
|
90
|
+
"serverApiKey": "string"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
"authenticationEnabled": {
|
|
95
|
+
"type": "boolean",
|
|
96
|
+
"default": true
|
|
97
|
+
},
|
|
98
|
+
"anonymousAllowed": {
|
|
99
|
+
"type": "boolean",
|
|
100
|
+
"default": true
|
|
101
|
+
},
|
|
102
|
+
"authenticationSchemes": [
|
|
103
|
+
{
|
|
104
|
+
"scheme": {
|
|
105
|
+
"type": "string",
|
|
106
|
+
"description": "See the API docs for the list of supported values."
|
|
107
|
+
},
|
|
108
|
+
"credential": {
|
|
109
|
+
"type": "object",
|
|
110
|
+
"description": "Scheme-specific credentials"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
|
|
115
|
+
"status": {
|
|
116
|
+
"type": "string",
|
|
117
|
+
"default": "sandbox",
|
|
118
|
+
"description": "Status of the application, production/sandbox/disabled"
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
"created": {
|
|
122
|
+
"type": "date",
|
|
123
|
+
"defaultFn": "now"
|
|
124
|
+
},
|
|
125
|
+
"modified": {
|
|
126
|
+
"type": "date",
|
|
127
|
+
"defaultFn": "now"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Change",
|
|
3
|
+
"trackChanges": false,
|
|
4
|
+
"properties": {
|
|
5
|
+
"id": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"id": true
|
|
8
|
+
},
|
|
9
|
+
"rev": {
|
|
10
|
+
"type": "string"
|
|
11
|
+
},
|
|
12
|
+
"prev": {
|
|
13
|
+
"type": "string"
|
|
14
|
+
},
|
|
15
|
+
"checkpoint": {
|
|
16
|
+
"type": "number"
|
|
17
|
+
},
|
|
18
|
+
"modelName": {
|
|
19
|
+
"type": "string"
|
|
20
|
+
},
|
|
21
|
+
"modelId": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Email",
|
|
3
|
+
"base": "Model",
|
|
4
|
+
"properties": {
|
|
5
|
+
"to": { "type": "String", "required": true },
|
|
6
|
+
"from": { "type": "String", "required": true },
|
|
7
|
+
"subject": { "type": "String", "required": true },
|
|
8
|
+
"text": { "type": "String" },
|
|
9
|
+
"html": { "type": "String" }
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "RoleMapping",
|
|
3
|
+
"description": "Map principals to roles",
|
|
4
|
+
"properties": {
|
|
5
|
+
"id": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"id": true,
|
|
8
|
+
"generated": true
|
|
9
|
+
},
|
|
10
|
+
"principalType": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "The principal type, such as USER, APPLICATION, ROLE, or user model name in case of multiple user models"
|
|
13
|
+
},
|
|
14
|
+
"principalId": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"index": true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"relations": {
|
|
20
|
+
"role": {
|
|
21
|
+
"type": "belongsTo",
|
|
22
|
+
"model": "Role",
|
|
23
|
+
"foreignKey": "roleId"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Role",
|
|
3
|
+
"properties": {
|
|
4
|
+
"id": {
|
|
5
|
+
"type": "string",
|
|
6
|
+
"id": true,
|
|
7
|
+
"generated": true
|
|
8
|
+
},
|
|
9
|
+
"name": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"required": true
|
|
12
|
+
},
|
|
13
|
+
"description": "string",
|
|
14
|
+
"created": {
|
|
15
|
+
"type": "date",
|
|
16
|
+
"defaultFn": "now"
|
|
17
|
+
},
|
|
18
|
+
"modified": {
|
|
19
|
+
"type": "date",
|
|
20
|
+
"defaultFn": "now"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"relations": {
|
|
24
|
+
"principals": {
|
|
25
|
+
"type": "hasMany",
|
|
26
|
+
"model": "RoleMapping",
|
|
27
|
+
"foreignKey": "roleId"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Scope",
|
|
3
|
+
"description": [
|
|
4
|
+
"Schema for Scope which represents the permissions that are granted",
|
|
5
|
+
"to client applications by the resource owner"
|
|
6
|
+
],
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"required": true
|
|
11
|
+
},
|
|
12
|
+
"description": "string"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "User",
|
|
3
|
+
"properties": {
|
|
4
|
+
"realm": {
|
|
5
|
+
"type": "string"
|
|
6
|
+
},
|
|
7
|
+
"username": {
|
|
8
|
+
"type": "string"
|
|
9
|
+
},
|
|
10
|
+
"password": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"required": true
|
|
13
|
+
},
|
|
14
|
+
"email": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"required": true
|
|
17
|
+
},
|
|
18
|
+
"emailVerified": "boolean",
|
|
19
|
+
"verificationToken": "string"
|
|
20
|
+
},
|
|
21
|
+
"options": {
|
|
22
|
+
"caseSensitiveEmail": true
|
|
23
|
+
},
|
|
24
|
+
"hidden": ["password", "verificationToken"],
|
|
25
|
+
"acls": [
|
|
26
|
+
{
|
|
27
|
+
"principalType": "ROLE",
|
|
28
|
+
"principalId": "$everyone",
|
|
29
|
+
"permission": "DENY"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"principalType": "ROLE",
|
|
33
|
+
"principalId": "$everyone",
|
|
34
|
+
"permission": "ALLOW",
|
|
35
|
+
"property": "create"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"principalType": "ROLE",
|
|
39
|
+
"principalId": "$owner",
|
|
40
|
+
"permission": "ALLOW",
|
|
41
|
+
"property": "deleteById"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"principalType": "ROLE",
|
|
45
|
+
"principalId": "$everyone",
|
|
46
|
+
"permission": "ALLOW",
|
|
47
|
+
"property": "login"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"principalType": "ROLE",
|
|
51
|
+
"principalId": "$everyone",
|
|
52
|
+
"permission": "ALLOW",
|
|
53
|
+
"property": "logout"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"principalType": "ROLE",
|
|
57
|
+
"principalId": "$owner",
|
|
58
|
+
"permission": "ALLOW",
|
|
59
|
+
"property": "findById"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"principalType": "ROLE",
|
|
63
|
+
"principalId": "$owner",
|
|
64
|
+
"permission": "ALLOW",
|
|
65
|
+
"property": "patchAttributes"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"principalType": "ROLE",
|
|
69
|
+
"principalId": "$owner",
|
|
70
|
+
"permission": "ALLOW",
|
|
71
|
+
"property": "replaceById"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"principalType": "ROLE",
|
|
75
|
+
"principalId": "$everyone",
|
|
76
|
+
"permission": "ALLOW",
|
|
77
|
+
"property": "verify",
|
|
78
|
+
"accessType": "EXECUTE"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"principalType": "ROLE",
|
|
82
|
+
"principalId": "$everyone",
|
|
83
|
+
"permission": "ALLOW",
|
|
84
|
+
"property": "confirm"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"principalType": "ROLE",
|
|
88
|
+
"principalId": "$everyone",
|
|
89
|
+
"permission": "ALLOW",
|
|
90
|
+
"property": "resetPassword",
|
|
91
|
+
"accessType": "EXECUTE"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"principalType": "ROLE",
|
|
95
|
+
"principalId": "$authenticated",
|
|
96
|
+
"permission": "ALLOW",
|
|
97
|
+
"property": "changePassword",
|
|
98
|
+
"accessType": "EXECUTE"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"principalType": "ROLE",
|
|
102
|
+
"principalId": "$authenticated",
|
|
103
|
+
"permission": "ALLOW",
|
|
104
|
+
"property": "setPassword",
|
|
105
|
+
"accessType": "EXECUTE"
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"relations": {
|
|
109
|
+
"accessTokens": {
|
|
110
|
+
"type": "hasMany",
|
|
111
|
+
"model": "AccessToken",
|
|
112
|
+
"foreignKey": "userId",
|
|
113
|
+
"options": {
|
|
114
|
+
"disableInclude": true
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|