@foir/sdk 0.22.0 → 0.23.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/CHANGELOG.md +51 -0
- package/README.md +6 -6
- package/dist/app/client.d.ts +5 -4
- package/dist/app/errors.d.ts +8 -6
- package/dist/auth/auth.d.ts +41 -9
- package/dist/auth/grant-table.generated.d.ts +5 -4
- package/dist/auth/hosted.d.ts +24 -0
- package/dist/auth/index.d.ts +4 -4
- package/dist/auth/operations.d.ts +28 -4
- package/dist/auth.js +174 -123
- package/dist/client.js +1 -4
- package/dist/codegen/preset.d.ts +1 -1
- package/dist/data/client.d.ts +1 -1
- package/dist/data/schema.d.ts +1 -1
- package/dist/data/transport.d.ts +7 -6
- package/dist/data.js +2 -5
- package/dist/index.js +1 -4
- package/dist/next.js +1 -4
- package/dist/placement.js +124 -116
- package/dist/push.js +1 -4
- package/dist/react/FoirProvider.d.ts +1 -1
- package/dist/react/feedback-notes.d.ts +4 -2
- package/dist/react.js +125 -120
- package/dist/server/events-client.d.ts +7 -7
- package/dist/server/types.d.ts +1 -1
- package/dist/server.js +121 -120
- package/dist/transport/foir-http.d.ts +1 -1
- package/dist/transport/key-kind.d.ts +1 -12
- package/package.json +3 -3
package/dist/placement.js
CHANGED
|
@@ -1,124 +1,124 @@
|
|
|
1
1
|
// src/auth/grant-table.generated.ts
|
|
2
2
|
var GRANT_TABLE = [
|
|
3
|
-
["records:read",
|
|
4
|
-
["records:create",
|
|
5
|
-
["records:write",
|
|
6
|
-
["records:delete",
|
|
7
|
-
["records:publish",
|
|
8
|
-
["records:attribute",
|
|
9
|
-
["search:read",
|
|
10
|
-
["embeddings:read",
|
|
11
|
-
["embeddings:write",
|
|
12
|
-
["schemas:read",
|
|
13
|
-
["drafts:read",
|
|
14
|
-
["files:read",
|
|
15
|
-
["files:write",
|
|
16
|
-
["files:delete",
|
|
17
|
-
["notifications:read",
|
|
18
|
-
["notifications:write",
|
|
19
|
-
["notifications:consent",
|
|
20
|
-
["pushcredentials:read",
|
|
21
|
-
["pushcredentials:write",
|
|
22
|
-
["notes:read",
|
|
23
|
-
["notes:write",
|
|
24
|
-
["notes:create",
|
|
25
|
-
["approvals:read",
|
|
26
|
-
["approvals:write",
|
|
27
|
-
["rooms:read",
|
|
28
|
-
["rooms:write",
|
|
29
|
-
["presence:read",
|
|
30
|
-
["operations:read",
|
|
31
|
-
["operations:execute",
|
|
32
|
-
["operations:write",
|
|
33
|
-
["operations:complete",
|
|
34
|
-
["status:write",
|
|
35
|
-
["appconfig:read",
|
|
36
|
-
["schedules:read",
|
|
37
|
-
["schedules:write",
|
|
38
|
-
["hooks:read",
|
|
39
|
-
["hooks:write",
|
|
40
|
-
["
|
|
41
|
-
["
|
|
42
|
-
["domains:read",
|
|
43
|
-
["domains:write",
|
|
44
|
-
["secrets:read",
|
|
45
|
-
["secrets:list",
|
|
46
|
-
["secrets:put",
|
|
47
|
-
["secrets:delete",
|
|
48
|
-
["appsecrets:read",
|
|
49
|
-
["appsecrets:list",
|
|
50
|
-
["appsecrets:put",
|
|
51
|
-
["appsecrets:delete",
|
|
52
|
-
["opsecrets:read",
|
|
53
|
-
["opsecrets:write",
|
|
54
|
-
["settings:read",
|
|
55
|
-
["settings:write",
|
|
56
|
-
["designtokens:read",
|
|
57
|
-
["designtokens:write",
|
|
58
|
-
["models:read",
|
|
59
|
-
["models:write",
|
|
60
|
-
["configs:read",
|
|
61
|
-
["configs:write",
|
|
62
|
-
["apps:read",
|
|
63
|
-
["apps:write",
|
|
64
|
-
["events:read",
|
|
65
|
-
["targeting:debug",
|
|
66
|
-
["visitors:forward",
|
|
67
|
-
["apikeys:read",
|
|
68
|
-
["apikeys:write",
|
|
69
|
-
["organizations:read",
|
|
70
|
-
["organizations:write",
|
|
71
|
-
["organizations:create",
|
|
72
|
-
["organizations:delete",
|
|
73
|
-
["organizations:reach",
|
|
74
|
-
["members:read",
|
|
75
|
-
["members:write",
|
|
76
|
-
["roles:read",
|
|
77
|
-
["roles:write",
|
|
78
|
-
["projects:read",
|
|
79
|
-
["projects:write",
|
|
80
|
-
["project:stand",
|
|
81
|
-
["project:manage",
|
|
82
|
-
["projects:create",
|
|
83
|
-
["projects:delete",
|
|
84
|
-
["tenants:read",
|
|
85
|
-
["tenants:write",
|
|
86
|
-
["tenants:delete",
|
|
87
|
-
["audit:read",
|
|
88
|
-
["export:run",
|
|
89
|
-
["billing:read",
|
|
90
|
-
["billing:manage",
|
|
91
|
-
["usage:read",
|
|
92
|
-
["controlkeys:read",
|
|
93
|
-
["controlkeys:write",
|
|
94
|
-
["
|
|
95
|
-
["
|
|
96
|
-
["
|
|
97
|
-
["
|
|
98
|
-
["
|
|
99
|
-
["
|
|
100
|
-
["platform:
|
|
101
|
-
["
|
|
102
|
-
["
|
|
103
|
-
["users:
|
|
104
|
-
["users:
|
|
105
|
-
["users:
|
|
106
|
-
["
|
|
107
|
-
["
|
|
108
|
-
["
|
|
109
|
-
["
|
|
110
|
-
["usersecrets:
|
|
111
|
-
["usersecrets:
|
|
112
|
-
["
|
|
113
|
-
["
|
|
114
|
-
["
|
|
115
|
-
["signinproviders:read", false, [], []],
|
|
116
|
-
["signinproviders:write", false, [], []]
|
|
3
|
+
["records:read", "model", ["own", "all"], []],
|
|
4
|
+
["records:create", "model", [], []],
|
|
5
|
+
["records:write", "model", ["own", "all"], []],
|
|
6
|
+
["records:delete", "model", ["own", "all"], []],
|
|
7
|
+
["records:publish", "model", ["own", "all"], []],
|
|
8
|
+
["records:attribute", "model", [], []],
|
|
9
|
+
["search:read", "model", [], []],
|
|
10
|
+
["embeddings:read", "none", [], []],
|
|
11
|
+
["embeddings:write", "none", [], []],
|
|
12
|
+
["schemas:read", "none", [], []],
|
|
13
|
+
["drafts:read", "none", [], []],
|
|
14
|
+
["files:read", "none", ["own", "all"], []],
|
|
15
|
+
["files:write", "none", ["own", "all"], []],
|
|
16
|
+
["files:delete", "none", ["own", "all"], []],
|
|
17
|
+
["notifications:read", "none", ["own", "all"], []],
|
|
18
|
+
["notifications:write", "none", ["own", "named", "all"], []],
|
|
19
|
+
["notifications:consent", "none", [], []],
|
|
20
|
+
["pushcredentials:read", "none", [], []],
|
|
21
|
+
["pushcredentials:write", "none", [], []],
|
|
22
|
+
["notes:read", "none", ["own", "all"], []],
|
|
23
|
+
["notes:write", "none", ["own", "all"], []],
|
|
24
|
+
["notes:create", "none", [], []],
|
|
25
|
+
["approvals:read", "none", [], []],
|
|
26
|
+
["approvals:write", "none", [], []],
|
|
27
|
+
["rooms:read", "model", [], []],
|
|
28
|
+
["rooms:write", "model", [], []],
|
|
29
|
+
["presence:read", "model", [], []],
|
|
30
|
+
["operations:read", "none", [], []],
|
|
31
|
+
["operations:execute", "operation", [], []],
|
|
32
|
+
["operations:write", "none", [], []],
|
|
33
|
+
["operations:complete", "none", [], []],
|
|
34
|
+
["status:write", "none", [], []],
|
|
35
|
+
["appconfig:read", "none", [], []],
|
|
36
|
+
["schedules:read", "none", [], []],
|
|
37
|
+
["schedules:write", "none", [], []],
|
|
38
|
+
["hooks:read", "none", [], []],
|
|
39
|
+
["hooks:write", "none", [], []],
|
|
40
|
+
["authclients:read", "none", [], []],
|
|
41
|
+
["authclients:write", "none", [], []],
|
|
42
|
+
["domains:read", "none", [], []],
|
|
43
|
+
["domains:write", "none", [], []],
|
|
44
|
+
["secrets:read", "none", [], []],
|
|
45
|
+
["secrets:list", "none", [], []],
|
|
46
|
+
["secrets:put", "none", [], []],
|
|
47
|
+
["secrets:delete", "none", [], []],
|
|
48
|
+
["appsecrets:read", "none", [], []],
|
|
49
|
+
["appsecrets:list", "none", [], []],
|
|
50
|
+
["appsecrets:put", "none", [], []],
|
|
51
|
+
["appsecrets:delete", "none", [], []],
|
|
52
|
+
["opsecrets:read", "none", [], []],
|
|
53
|
+
["opsecrets:write", "none", [], []],
|
|
54
|
+
["settings:read", "none", [], []],
|
|
55
|
+
["settings:write", "none", [], []],
|
|
56
|
+
["designtokens:read", "none", [], []],
|
|
57
|
+
["designtokens:write", "none", [], []],
|
|
58
|
+
["models:read", "none", [], []],
|
|
59
|
+
["models:write", "none", [], []],
|
|
60
|
+
["configs:read", "none", [], []],
|
|
61
|
+
["configs:write", "none", [], []],
|
|
62
|
+
["apps:read", "none", [], []],
|
|
63
|
+
["apps:write", "none", [], []],
|
|
64
|
+
["events:read", "none", [], []],
|
|
65
|
+
["targeting:debug", "none", [], []],
|
|
66
|
+
["visitors:forward", "none", [], []],
|
|
67
|
+
["apikeys:read", "none", [], []],
|
|
68
|
+
["apikeys:write", "none", [], []],
|
|
69
|
+
["organizations:read", "none", [], []],
|
|
70
|
+
["organizations:write", "none", [], []],
|
|
71
|
+
["organizations:create", "none", [], []],
|
|
72
|
+
["organizations:delete", "none", [], []],
|
|
73
|
+
["organizations:reach", "none", [], []],
|
|
74
|
+
["members:read", "none", [], []],
|
|
75
|
+
["members:write", "none", [], []],
|
|
76
|
+
["roles:read", "none", [], []],
|
|
77
|
+
["roles:write", "none", [], []],
|
|
78
|
+
["projects:read", "none", [], []],
|
|
79
|
+
["projects:write", "none", [], []],
|
|
80
|
+
["project:stand", "none", [], []],
|
|
81
|
+
["project:manage", "none", [], ["project:stand", "records:read.all", "records:create", "records:write.all", "records:delete.all", "records:publish.all", "records:attribute", "search:read", "embeddings:read", "embeddings:write", "schemas:read", "drafts:read", "files:read.all", "files:write.all", "files:delete.all", "users:read.all", "identities:read", "users:create", "identities:delete", "users:write.all", "users:setup", "users:delete.all", "notifications:read.all", "notifications:write.all", "notifications:consent", "pushcredentials:read", "pushcredentials:write", "notes:read.all", "notes:write.all", "notes:create", "approvals:read", "approvals:write", "rooms:read", "rooms:write", "presence:read", "operations:read", "operations:execute", "operations:write", "appconfig:read", "schedules:read", "schedules:write", "hooks:read", "hooks:write", "auth:login_with_foir", "authclients:read", "authclients:write", "domains:read", "domains:write", "secrets:read", "secrets:list", "secrets:put", "secrets:delete", "appsecrets:read", "appsecrets:list", "appsecrets:put", "appsecrets:delete", "usersecrets:read", "usersecrets:list", "usersecrets:put", "usersecrets:delete", "opsecrets:read", "opsecrets:write", "settings:read", "settings:write", "designtokens:read", "designtokens:write", "models:read", "models:write", "configs:read", "configs:write", "signinproviders:read", "signinproviders:write", "apps:read", "apps:write", "events:read", "targeting:debug", "visitors:forward", "apikeys:read", "apikeys:write", "organizations:read", "organizations:create", "organizations:delete", "organizations:write", "organizations:reach", "members:read", "members:write", "roles:read", "roles:write", "projects:read", "projects:write", "audit:read"]],
|
|
82
|
+
["projects:create", "none", [], []],
|
|
83
|
+
["projects:delete", "none", [], []],
|
|
84
|
+
["tenants:read", "none", [], []],
|
|
85
|
+
["tenants:write", "none", [], []],
|
|
86
|
+
["tenants:delete", "none", [], []],
|
|
87
|
+
["audit:read", "none", [], []],
|
|
88
|
+
["export:run", "none", [], []],
|
|
89
|
+
["billing:read", "none", [], []],
|
|
90
|
+
["billing:manage", "none", [], []],
|
|
91
|
+
["usage:read", "none", [], []],
|
|
92
|
+
["controlkeys:read", "none", [], []],
|
|
93
|
+
["controlkeys:write", "none", [], []],
|
|
94
|
+
["tenanthooks:read", "none", [], []],
|
|
95
|
+
["tenanthooks:write", "none", [], []],
|
|
96
|
+
["apps:install", "none", [], []],
|
|
97
|
+
["tenant:manage", "none", [], ["project:manage", "projects:create", "projects:delete", "tenants:read", "tenants:write", "tenants:delete", "export:run", "billing:read", "billing:manage", "usage:read", "controlkeys:read", "controlkeys:write", "tenanthooks:read", "tenanthooks:write", "apps:install"]],
|
|
98
|
+
["platform:read", "none", [], []],
|
|
99
|
+
["platform:manage", "none", [], ["tenant:manage", "platform:read", "platform:create_workspace"]],
|
|
100
|
+
["platform:create_workspace", "none", [], []],
|
|
101
|
+
["users:read", "none", ["own", "named", "all"], []],
|
|
102
|
+
["users:write", "none", ["own", "all"], []],
|
|
103
|
+
["users:setup", "none", [], []],
|
|
104
|
+
["users:delete", "none", ["own", "all"], []],
|
|
105
|
+
["users:create", "none", [], []],
|
|
106
|
+
["identities:read", "none", [], []],
|
|
107
|
+
["identities:delete", "none", [], []],
|
|
108
|
+
["usersecrets:read", "none", [], []],
|
|
109
|
+
["usersecrets:list", "none", [], []],
|
|
110
|
+
["usersecrets:put", "none", [], []],
|
|
111
|
+
["usersecrets:delete", "none", [], []],
|
|
112
|
+
["auth:login_with_foir", "none", [], []],
|
|
113
|
+
["signinproviders:read", "none", [], []],
|
|
114
|
+
["signinproviders:write", "none", [], []]
|
|
117
115
|
];
|
|
118
116
|
|
|
119
117
|
// src/auth/grants.ts
|
|
120
118
|
var WILDCARD = "*";
|
|
121
119
|
var RESOURCE_WILDCARD = ":*";
|
|
120
|
+
var FIELD_PERMISSIONS = ["records:read", "records:write"];
|
|
121
|
+
var FIELD_KEY = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
122
122
|
var index;
|
|
123
123
|
function catalogue() {
|
|
124
124
|
if (!index) {
|
|
@@ -159,15 +159,23 @@ function parseGrant(s) {
|
|
|
159
159
|
let target = "";
|
|
160
160
|
if (rest.startsWith(":")) {
|
|
161
161
|
target = rest.slice(1);
|
|
162
|
-
if (
|
|
162
|
+
if (permission[1] === "none") return null;
|
|
163
163
|
if (target === "" || /[: \t\n*]/.test(target)) return null;
|
|
164
|
+
const dot = target.indexOf(".");
|
|
165
|
+
if (permission[1] === "model" && dot >= 0) {
|
|
166
|
+
if (!FIELD_PERMISSIONS.includes(name) || dot === 0 || !FIELD_KEY.test(target.slice(dot + 1))) return null;
|
|
167
|
+
}
|
|
164
168
|
}
|
|
165
169
|
return { permission, reach, target };
|
|
166
170
|
}
|
|
167
171
|
return null;
|
|
168
172
|
}
|
|
169
173
|
function covers(held, required) {
|
|
170
|
-
|
|
174
|
+
if (held.permission !== required.permission || reachRank[held.reach] < reachRank[required.reach]) return false;
|
|
175
|
+
if (required.permission[1] === "model" && required.target.includes(".")) {
|
|
176
|
+
return held.target === required.target || held.target === "" && held.reach === "all";
|
|
177
|
+
}
|
|
178
|
+
return held.target === "" || held.target === required.target;
|
|
171
179
|
}
|
|
172
180
|
function resourceWildcard(held) {
|
|
173
181
|
if (!held.endsWith(RESOURCE_WILDCARD)) return null;
|
package/dist/push.js
CHANGED
|
@@ -5,10 +5,7 @@ import { print as print2 } from "graphql";
|
|
|
5
5
|
var KEY_PREFIXES = [
|
|
6
6
|
["foir_pub_", "publishable"],
|
|
7
7
|
["foir_srv_", "server"],
|
|
8
|
-
["foir_adm_", "admin"]
|
|
9
|
-
["pk_", "publishable"],
|
|
10
|
-
["sk_", "older"],
|
|
11
|
-
["tc_", "older"]
|
|
8
|
+
["foir_adm_", "admin"]
|
|
12
9
|
];
|
|
13
10
|
var FOIR_CREDENTIALS_DOC = "https://docs.foir.dev/credentials";
|
|
14
11
|
function foirKeyKind(apiKey) {
|
|
@@ -58,7 +58,7 @@ export interface FoirContextValue {
|
|
|
58
58
|
hostedSignInUrl: ((returnTo?: string) => string) | null;
|
|
59
59
|
}
|
|
60
60
|
export interface FoirProviderProps {
|
|
61
|
-
/** API config: `{ PLATFORM_API_URL, PLATFORM_API_KEY }` (a publishable
|
|
61
|
+
/** API config: `{ PLATFORM_API_URL, PLATFORM_API_KEY }` (a publishable key). */
|
|
62
62
|
env: FoirEnv;
|
|
63
63
|
/** Session store for token mode. Defaults to a browser localStorage adapter. */
|
|
64
64
|
adapter?: SessionAdapter;
|
|
@@ -61,8 +61,10 @@ export type FoirFeedbackFault = {
|
|
|
61
61
|
/**
|
|
62
62
|
* Read the refusal, if it is one of the two the widget can act on.
|
|
63
63
|
*
|
|
64
|
-
* Matched on the platform's own sentences rather than on an error code
|
|
65
|
-
*
|
|
64
|
+
* Matched on the platform's own sentences rather than on an error code: the
|
|
65
|
+
* sign-in refusal carries no `extensions.code`, and the scope refusal's code
|
|
66
|
+
* (`PERMISSION_DENIED`) does not say which permission, which only its sentence
|
|
67
|
+
* names.
|
|
66
68
|
* Both the wrapper's message and every individual GraphQL error are scanned: the
|
|
67
69
|
* transport joins them into one string on the way out, but a partial-error
|
|
68
70
|
* envelope keeps them apart, and only one of the two forms is guaranteed.
|
package/dist/react.js
CHANGED
|
@@ -18,10 +18,7 @@ import { print as print2 } from "graphql";
|
|
|
18
18
|
var KEY_PREFIXES = [
|
|
19
19
|
["foir_pub_", "publishable"],
|
|
20
20
|
["foir_srv_", "server"],
|
|
21
|
-
["foir_adm_", "admin"]
|
|
22
|
-
["pk_", "publishable"],
|
|
23
|
-
["sk_", "older"],
|
|
24
|
-
["tc_", "older"]
|
|
21
|
+
["foir_adm_", "admin"]
|
|
25
22
|
];
|
|
26
23
|
function foirKeyKind(apiKey) {
|
|
27
24
|
if (typeof apiKey !== "string") return void 0;
|
|
@@ -1200,125 +1197,125 @@ async function authedOp(adapter, env, op, args) {
|
|
|
1200
1197
|
|
|
1201
1198
|
// src/auth/grant-table.generated.ts
|
|
1202
1199
|
var GRANT_TABLE = [
|
|
1203
|
-
["records:read",
|
|
1204
|
-
["records:create",
|
|
1205
|
-
["records:write",
|
|
1206
|
-
["records:delete",
|
|
1207
|
-
["records:publish",
|
|
1208
|
-
["records:attribute",
|
|
1209
|
-
["search:read",
|
|
1210
|
-
["embeddings:read",
|
|
1211
|
-
["embeddings:write",
|
|
1212
|
-
["schemas:read",
|
|
1213
|
-
["drafts:read",
|
|
1214
|
-
["files:read",
|
|
1215
|
-
["files:write",
|
|
1216
|
-
["files:delete",
|
|
1217
|
-
["notifications:read",
|
|
1218
|
-
["notifications:write",
|
|
1219
|
-
["notifications:consent",
|
|
1220
|
-
["pushcredentials:read",
|
|
1221
|
-
["pushcredentials:write",
|
|
1222
|
-
["notes:read",
|
|
1223
|
-
["notes:write",
|
|
1224
|
-
["notes:create",
|
|
1225
|
-
["approvals:read",
|
|
1226
|
-
["approvals:write",
|
|
1227
|
-
["rooms:read",
|
|
1228
|
-
["rooms:write",
|
|
1229
|
-
["presence:read",
|
|
1230
|
-
["operations:read",
|
|
1231
|
-
["operations:execute",
|
|
1232
|
-
["operations:write",
|
|
1233
|
-
["operations:complete",
|
|
1234
|
-
["status:write",
|
|
1235
|
-
["appconfig:read",
|
|
1236
|
-
["schedules:read",
|
|
1237
|
-
["schedules:write",
|
|
1238
|
-
["hooks:read",
|
|
1239
|
-
["hooks:write",
|
|
1240
|
-
["
|
|
1241
|
-
["
|
|
1242
|
-
["domains:read",
|
|
1243
|
-
["domains:write",
|
|
1244
|
-
["secrets:read",
|
|
1245
|
-
["secrets:list",
|
|
1246
|
-
["secrets:put",
|
|
1247
|
-
["secrets:delete",
|
|
1248
|
-
["appsecrets:read",
|
|
1249
|
-
["appsecrets:list",
|
|
1250
|
-
["appsecrets:put",
|
|
1251
|
-
["appsecrets:delete",
|
|
1252
|
-
["opsecrets:read",
|
|
1253
|
-
["opsecrets:write",
|
|
1254
|
-
["settings:read",
|
|
1255
|
-
["settings:write",
|
|
1256
|
-
["designtokens:read",
|
|
1257
|
-
["designtokens:write",
|
|
1258
|
-
["models:read",
|
|
1259
|
-
["models:write",
|
|
1260
|
-
["configs:read",
|
|
1261
|
-
["configs:write",
|
|
1262
|
-
["apps:read",
|
|
1263
|
-
["apps:write",
|
|
1264
|
-
["events:read",
|
|
1265
|
-
["targeting:debug",
|
|
1266
|
-
["visitors:forward",
|
|
1267
|
-
["apikeys:read",
|
|
1268
|
-
["apikeys:write",
|
|
1269
|
-
["organizations:read",
|
|
1270
|
-
["organizations:write",
|
|
1271
|
-
["organizations:create",
|
|
1272
|
-
["organizations:delete",
|
|
1273
|
-
["organizations:reach",
|
|
1274
|
-
["members:read",
|
|
1275
|
-
["members:write",
|
|
1276
|
-
["roles:read",
|
|
1277
|
-
["roles:write",
|
|
1278
|
-
["projects:read",
|
|
1279
|
-
["projects:write",
|
|
1280
|
-
["project:stand",
|
|
1281
|
-
["project:manage",
|
|
1282
|
-
["projects:create",
|
|
1283
|
-
["projects:delete",
|
|
1284
|
-
["tenants:read",
|
|
1285
|
-
["tenants:write",
|
|
1286
|
-
["tenants:delete",
|
|
1287
|
-
["audit:read",
|
|
1288
|
-
["export:run",
|
|
1289
|
-
["billing:read",
|
|
1290
|
-
["billing:manage",
|
|
1291
|
-
["usage:read",
|
|
1292
|
-
["controlkeys:read",
|
|
1293
|
-
["controlkeys:write",
|
|
1294
|
-
["
|
|
1295
|
-
["
|
|
1296
|
-
["
|
|
1297
|
-
["
|
|
1298
|
-
["
|
|
1299
|
-
["
|
|
1300
|
-
["platform:
|
|
1301
|
-
["
|
|
1302
|
-
["
|
|
1303
|
-
["users:
|
|
1304
|
-
["users:
|
|
1305
|
-
["users:
|
|
1306
|
-
["
|
|
1307
|
-
["
|
|
1308
|
-
["
|
|
1309
|
-
["
|
|
1310
|
-
["usersecrets:
|
|
1311
|
-
["usersecrets:
|
|
1312
|
-
["
|
|
1313
|
-
["
|
|
1314
|
-
["
|
|
1315
|
-
["signinproviders:read", false, [], []],
|
|
1316
|
-
["signinproviders:write", false, [], []]
|
|
1200
|
+
["records:read", "model", ["own", "all"], []],
|
|
1201
|
+
["records:create", "model", [], []],
|
|
1202
|
+
["records:write", "model", ["own", "all"], []],
|
|
1203
|
+
["records:delete", "model", ["own", "all"], []],
|
|
1204
|
+
["records:publish", "model", ["own", "all"], []],
|
|
1205
|
+
["records:attribute", "model", [], []],
|
|
1206
|
+
["search:read", "model", [], []],
|
|
1207
|
+
["embeddings:read", "none", [], []],
|
|
1208
|
+
["embeddings:write", "none", [], []],
|
|
1209
|
+
["schemas:read", "none", [], []],
|
|
1210
|
+
["drafts:read", "none", [], []],
|
|
1211
|
+
["files:read", "none", ["own", "all"], []],
|
|
1212
|
+
["files:write", "none", ["own", "all"], []],
|
|
1213
|
+
["files:delete", "none", ["own", "all"], []],
|
|
1214
|
+
["notifications:read", "none", ["own", "all"], []],
|
|
1215
|
+
["notifications:write", "none", ["own", "named", "all"], []],
|
|
1216
|
+
["notifications:consent", "none", [], []],
|
|
1217
|
+
["pushcredentials:read", "none", [], []],
|
|
1218
|
+
["pushcredentials:write", "none", [], []],
|
|
1219
|
+
["notes:read", "none", ["own", "all"], []],
|
|
1220
|
+
["notes:write", "none", ["own", "all"], []],
|
|
1221
|
+
["notes:create", "none", [], []],
|
|
1222
|
+
["approvals:read", "none", [], []],
|
|
1223
|
+
["approvals:write", "none", [], []],
|
|
1224
|
+
["rooms:read", "model", [], []],
|
|
1225
|
+
["rooms:write", "model", [], []],
|
|
1226
|
+
["presence:read", "model", [], []],
|
|
1227
|
+
["operations:read", "none", [], []],
|
|
1228
|
+
["operations:execute", "operation", [], []],
|
|
1229
|
+
["operations:write", "none", [], []],
|
|
1230
|
+
["operations:complete", "none", [], []],
|
|
1231
|
+
["status:write", "none", [], []],
|
|
1232
|
+
["appconfig:read", "none", [], []],
|
|
1233
|
+
["schedules:read", "none", [], []],
|
|
1234
|
+
["schedules:write", "none", [], []],
|
|
1235
|
+
["hooks:read", "none", [], []],
|
|
1236
|
+
["hooks:write", "none", [], []],
|
|
1237
|
+
["authclients:read", "none", [], []],
|
|
1238
|
+
["authclients:write", "none", [], []],
|
|
1239
|
+
["domains:read", "none", [], []],
|
|
1240
|
+
["domains:write", "none", [], []],
|
|
1241
|
+
["secrets:read", "none", [], []],
|
|
1242
|
+
["secrets:list", "none", [], []],
|
|
1243
|
+
["secrets:put", "none", [], []],
|
|
1244
|
+
["secrets:delete", "none", [], []],
|
|
1245
|
+
["appsecrets:read", "none", [], []],
|
|
1246
|
+
["appsecrets:list", "none", [], []],
|
|
1247
|
+
["appsecrets:put", "none", [], []],
|
|
1248
|
+
["appsecrets:delete", "none", [], []],
|
|
1249
|
+
["opsecrets:read", "none", [], []],
|
|
1250
|
+
["opsecrets:write", "none", [], []],
|
|
1251
|
+
["settings:read", "none", [], []],
|
|
1252
|
+
["settings:write", "none", [], []],
|
|
1253
|
+
["designtokens:read", "none", [], []],
|
|
1254
|
+
["designtokens:write", "none", [], []],
|
|
1255
|
+
["models:read", "none", [], []],
|
|
1256
|
+
["models:write", "none", [], []],
|
|
1257
|
+
["configs:read", "none", [], []],
|
|
1258
|
+
["configs:write", "none", [], []],
|
|
1259
|
+
["apps:read", "none", [], []],
|
|
1260
|
+
["apps:write", "none", [], []],
|
|
1261
|
+
["events:read", "none", [], []],
|
|
1262
|
+
["targeting:debug", "none", [], []],
|
|
1263
|
+
["visitors:forward", "none", [], []],
|
|
1264
|
+
["apikeys:read", "none", [], []],
|
|
1265
|
+
["apikeys:write", "none", [], []],
|
|
1266
|
+
["organizations:read", "none", [], []],
|
|
1267
|
+
["organizations:write", "none", [], []],
|
|
1268
|
+
["organizations:create", "none", [], []],
|
|
1269
|
+
["organizations:delete", "none", [], []],
|
|
1270
|
+
["organizations:reach", "none", [], []],
|
|
1271
|
+
["members:read", "none", [], []],
|
|
1272
|
+
["members:write", "none", [], []],
|
|
1273
|
+
["roles:read", "none", [], []],
|
|
1274
|
+
["roles:write", "none", [], []],
|
|
1275
|
+
["projects:read", "none", [], []],
|
|
1276
|
+
["projects:write", "none", [], []],
|
|
1277
|
+
["project:stand", "none", [], []],
|
|
1278
|
+
["project:manage", "none", [], ["project:stand", "records:read.all", "records:create", "records:write.all", "records:delete.all", "records:publish.all", "records:attribute", "search:read", "embeddings:read", "embeddings:write", "schemas:read", "drafts:read", "files:read.all", "files:write.all", "files:delete.all", "users:read.all", "identities:read", "users:create", "identities:delete", "users:write.all", "users:setup", "users:delete.all", "notifications:read.all", "notifications:write.all", "notifications:consent", "pushcredentials:read", "pushcredentials:write", "notes:read.all", "notes:write.all", "notes:create", "approvals:read", "approvals:write", "rooms:read", "rooms:write", "presence:read", "operations:read", "operations:execute", "operations:write", "appconfig:read", "schedules:read", "schedules:write", "hooks:read", "hooks:write", "auth:login_with_foir", "authclients:read", "authclients:write", "domains:read", "domains:write", "secrets:read", "secrets:list", "secrets:put", "secrets:delete", "appsecrets:read", "appsecrets:list", "appsecrets:put", "appsecrets:delete", "usersecrets:read", "usersecrets:list", "usersecrets:put", "usersecrets:delete", "opsecrets:read", "opsecrets:write", "settings:read", "settings:write", "designtokens:read", "designtokens:write", "models:read", "models:write", "configs:read", "configs:write", "signinproviders:read", "signinproviders:write", "apps:read", "apps:write", "events:read", "targeting:debug", "visitors:forward", "apikeys:read", "apikeys:write", "organizations:read", "organizations:create", "organizations:delete", "organizations:write", "organizations:reach", "members:read", "members:write", "roles:read", "roles:write", "projects:read", "projects:write", "audit:read"]],
|
|
1279
|
+
["projects:create", "none", [], []],
|
|
1280
|
+
["projects:delete", "none", [], []],
|
|
1281
|
+
["tenants:read", "none", [], []],
|
|
1282
|
+
["tenants:write", "none", [], []],
|
|
1283
|
+
["tenants:delete", "none", [], []],
|
|
1284
|
+
["audit:read", "none", [], []],
|
|
1285
|
+
["export:run", "none", [], []],
|
|
1286
|
+
["billing:read", "none", [], []],
|
|
1287
|
+
["billing:manage", "none", [], []],
|
|
1288
|
+
["usage:read", "none", [], []],
|
|
1289
|
+
["controlkeys:read", "none", [], []],
|
|
1290
|
+
["controlkeys:write", "none", [], []],
|
|
1291
|
+
["tenanthooks:read", "none", [], []],
|
|
1292
|
+
["tenanthooks:write", "none", [], []],
|
|
1293
|
+
["apps:install", "none", [], []],
|
|
1294
|
+
["tenant:manage", "none", [], ["project:manage", "projects:create", "projects:delete", "tenants:read", "tenants:write", "tenants:delete", "export:run", "billing:read", "billing:manage", "usage:read", "controlkeys:read", "controlkeys:write", "tenanthooks:read", "tenanthooks:write", "apps:install"]],
|
|
1295
|
+
["platform:read", "none", [], []],
|
|
1296
|
+
["platform:manage", "none", [], ["tenant:manage", "platform:read", "platform:create_workspace"]],
|
|
1297
|
+
["platform:create_workspace", "none", [], []],
|
|
1298
|
+
["users:read", "none", ["own", "named", "all"], []],
|
|
1299
|
+
["users:write", "none", ["own", "all"], []],
|
|
1300
|
+
["users:setup", "none", [], []],
|
|
1301
|
+
["users:delete", "none", ["own", "all"], []],
|
|
1302
|
+
["users:create", "none", [], []],
|
|
1303
|
+
["identities:read", "none", [], []],
|
|
1304
|
+
["identities:delete", "none", [], []],
|
|
1305
|
+
["usersecrets:read", "none", [], []],
|
|
1306
|
+
["usersecrets:list", "none", [], []],
|
|
1307
|
+
["usersecrets:put", "none", [], []],
|
|
1308
|
+
["usersecrets:delete", "none", [], []],
|
|
1309
|
+
["auth:login_with_foir", "none", [], []],
|
|
1310
|
+
["signinproviders:read", "none", [], []],
|
|
1311
|
+
["signinproviders:write", "none", [], []]
|
|
1317
1312
|
];
|
|
1318
1313
|
|
|
1319
1314
|
// src/auth/grants.ts
|
|
1320
1315
|
var WILDCARD = "*";
|
|
1321
1316
|
var RESOURCE_WILDCARD = ":*";
|
|
1317
|
+
var FIELD_PERMISSIONS = ["records:read", "records:write"];
|
|
1318
|
+
var FIELD_KEY = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
1322
1319
|
var index;
|
|
1323
1320
|
function catalogue() {
|
|
1324
1321
|
if (!index) {
|
|
@@ -1359,15 +1356,23 @@ function parseGrant(s) {
|
|
|
1359
1356
|
let target = "";
|
|
1360
1357
|
if (rest.startsWith(":")) {
|
|
1361
1358
|
target = rest.slice(1);
|
|
1362
|
-
if (
|
|
1359
|
+
if (permission[1] === "none") return null;
|
|
1363
1360
|
if (target === "" || /[: \t\n*]/.test(target)) return null;
|
|
1361
|
+
const dot = target.indexOf(".");
|
|
1362
|
+
if (permission[1] === "model" && dot >= 0) {
|
|
1363
|
+
if (!FIELD_PERMISSIONS.includes(name) || dot === 0 || !FIELD_KEY.test(target.slice(dot + 1))) return null;
|
|
1364
|
+
}
|
|
1364
1365
|
}
|
|
1365
1366
|
return { permission, reach, target };
|
|
1366
1367
|
}
|
|
1367
1368
|
return null;
|
|
1368
1369
|
}
|
|
1369
1370
|
function covers(held, required) {
|
|
1370
|
-
|
|
1371
|
+
if (held.permission !== required.permission || reachRank[held.reach] < reachRank[required.reach]) return false;
|
|
1372
|
+
if (required.permission[1] === "model" && required.target.includes(".")) {
|
|
1373
|
+
return held.target === required.target || held.target === "" && held.reach === "all";
|
|
1374
|
+
}
|
|
1375
|
+
return held.target === "" || held.target === required.target;
|
|
1371
1376
|
}
|
|
1372
1377
|
function resourceWildcard(held) {
|
|
1373
1378
|
if (!held.endsWith(RESOURCE_WILDCARD)) return null;
|