@sasjs/api 0.44.3 → 0.44.5
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/build/browser.js +535 -67
- package/build/cjs/corpus/records.js +272 -34
- package/build/cjs/host/dispatch.js +319 -32
- package/build/cjs/identity/records.js +5 -3
- package/build/cjs/routes/generated.js +35 -7
- package/build/esm/corpus/records.d.ts.map +1 -1
- package/build/esm/corpus/records.js +272 -34
- package/build/esm/host/dispatch.d.ts.map +1 -1
- package/build/esm/host/dispatch.js +319 -32
- package/build/esm/identity/records.d.ts +1 -1
- package/build/esm/identity/records.d.ts.map +1 -1
- package/build/esm/identity/records.js +5 -3
- package/build/esm/routes/generated.d.ts.map +1 -1
- package/build/esm/routes/generated.js +35 -7
- package/package.json +1 -1
|
@@ -102,26 +102,215 @@ const validate = (route, request) => {
|
|
|
102
102
|
};
|
|
103
103
|
/** The file an app is served from for a directory request, as the surface serves it. */
|
|
104
104
|
const APP_ENTRY_FILE = 'index.html';
|
|
105
|
+
/** A refusal worded the way Joi words it, so a caller sees one message on either host. */
|
|
106
|
+
const refused = (message) => new ApiError(400, message);
|
|
107
|
+
/** `Joi.string()`, with its type and emptiness refusals. */
|
|
108
|
+
const stringField = (field, value, allowEmpty = false) => {
|
|
109
|
+
if (typeof value !== 'string')
|
|
110
|
+
throw refused(`"${field}" must be a string`);
|
|
111
|
+
if (value === '' && !allowEmpty)
|
|
112
|
+
throw refused(`"${field}" is not allowed to be empty`);
|
|
113
|
+
return value;
|
|
114
|
+
};
|
|
115
|
+
/** `Joi.string().required()`, with its refusal for a field that is missing. */
|
|
116
|
+
const requiredField = (field, value) => {
|
|
117
|
+
if (value === undefined)
|
|
118
|
+
throw refused(`"${field}" is required`);
|
|
119
|
+
return stringField(field, value);
|
|
120
|
+
};
|
|
121
|
+
/** `Joi.string().alphanum().min(n).max(m)`, in its order and its wording. */
|
|
122
|
+
const alphanumeric = (field, value, min, max) => {
|
|
123
|
+
// alphanumeric, in either case: a username is folded before it is tested, a
|
|
124
|
+
// group's name is a label and keeps the case it was given
|
|
125
|
+
if (!/^[A-Za-z0-9]+$/.test(value))
|
|
126
|
+
throw refused(`"${field}" must only contain alpha-numeric characters`);
|
|
127
|
+
if (value.length < min)
|
|
128
|
+
throw refused(`"${field}" length must be at least ${min} characters long`);
|
|
129
|
+
if (value.length > max)
|
|
130
|
+
throw refused(`"${field}" length must be less than or equal to ${max} characters long`);
|
|
131
|
+
return value;
|
|
132
|
+
};
|
|
133
|
+
/** `Joi.string().min(n).max(m)`, in its order and its wording. */
|
|
134
|
+
const lengthBetween = (field, value, min, max) => {
|
|
135
|
+
if (value.length < min)
|
|
136
|
+
throw refused(`"${field}" length must be at least ${min} characters long`);
|
|
137
|
+
if (value.length > max)
|
|
138
|
+
throw refused(`"${field}" length must be less than or equal to ${max} characters long`);
|
|
139
|
+
return value;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* `displayName`'s rule, `Joi.string().trim().min(6)`: trimmed first, so a name of
|
|
143
|
+
* spaces is empty rather than short, which is the answer an installation gives.
|
|
144
|
+
*/
|
|
145
|
+
const trimmedName = (field, value) => {
|
|
146
|
+
const name = value.trim();
|
|
147
|
+
if (name === '')
|
|
148
|
+
throw refused(`"${field}" is not allowed to be empty`);
|
|
149
|
+
if (name.length < 6)
|
|
150
|
+
throw refused(`"${field}" length must be at least 6 characters long`);
|
|
151
|
+
return name;
|
|
152
|
+
};
|
|
153
|
+
/** The keys each of these bodies states; anything else is refused, as Joi does. */
|
|
154
|
+
const refuseUnknown = (body, keys) => {
|
|
155
|
+
for (const key of Object.keys(body))
|
|
156
|
+
if (!keys.includes(key))
|
|
157
|
+
throw refused(`"${key}" is not allowed`);
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* The routes sasjs/server guards with `verifyAdmin` before their schema runs.
|
|
161
|
+
*
|
|
162
|
+
* They are refused as callers first, so their body checks follow the gate - the order
|
|
163
|
+
* the installation's middleware produce. The identity routes gate the same way but
|
|
164
|
+
* validate through `controllerRules`, because their body rules are not the document's;
|
|
165
|
+
* `GET /permission` is absent because a caller may read their own rules there.
|
|
166
|
+
*/
|
|
167
|
+
const ADMIN_GATED_ROUTES = new Set([
|
|
168
|
+
'POST /SASjsApi/permission',
|
|
169
|
+
'PATCH /SASjsApi/permission/{uid}',
|
|
170
|
+
'DELETE /SASjsApi/permission/{uid}',
|
|
171
|
+
'GET /SASjsApi/client',
|
|
172
|
+
'POST /SASjsApi/client'
|
|
173
|
+
]);
|
|
174
|
+
/**
|
|
175
|
+
* `getUserValidation` for a `by/username` path parameter.
|
|
176
|
+
*
|
|
177
|
+
* The server validates that parameter with `usernameSchema` before the controller
|
|
178
|
+
* looks anything up, so the value is folded to lower case and checked against the
|
|
179
|
+
* same 3-to-16 alphanumeric rule - which is why `by/username/SASJSUSER` finds
|
|
180
|
+
* `sasjsuser` there. The gate that runs before it compares the raw parameter, so
|
|
181
|
+
* the folding happens here rather than in the caller's hands.
|
|
182
|
+
*/
|
|
183
|
+
const foldedUsername = (value) => alphanumeric('username', requiredField('username', value).toLowerCase(), 3, 16);
|
|
184
|
+
/**
|
|
185
|
+
* `deleteUserValidation`: the body a deletion carries.
|
|
186
|
+
*
|
|
187
|
+
* A caller deleting their own account supplies the password, and it is checked
|
|
188
|
+
* against the password schema before it is compared - so a short one is a 400 and
|
|
189
|
+
* never reaches the comparison. An administrator's deletion takes no body at all,
|
|
190
|
+
* and the schema declares no key for one.
|
|
191
|
+
*/
|
|
192
|
+
const deletionBody = (body, admin) => {
|
|
193
|
+
if (admin) {
|
|
194
|
+
for (const key of Object.keys(body))
|
|
195
|
+
throw refused(`"${key}" is not allowed`);
|
|
196
|
+
return {};
|
|
197
|
+
}
|
|
198
|
+
const password = lengthBetween('password', requiredField('password', body.password), 6, 1024);
|
|
199
|
+
for (const key of Object.keys(body))
|
|
200
|
+
if (key !== 'password')
|
|
201
|
+
throw refused(`"${key}" is not allowed`);
|
|
202
|
+
return { password };
|
|
203
|
+
};
|
|
204
|
+
/** The keys either user operation's body states; the two schemas declare the same six. */
|
|
205
|
+
const USER_KEYS = [
|
|
206
|
+
'displayName',
|
|
207
|
+
'username',
|
|
208
|
+
'password',
|
|
209
|
+
'isAdmin',
|
|
210
|
+
'isActive',
|
|
211
|
+
'autoExec'
|
|
212
|
+
];
|
|
213
|
+
/**
|
|
214
|
+
* `registerUserValidation`, in its order and its wording.
|
|
215
|
+
*
|
|
216
|
+
* The shared `validate` checks presence only, and in the document's order - so a
|
|
217
|
+
* body that trips two rules is refused for a different field here than on an
|
|
218
|
+
* installation, which is the class the update routes already had fixed. The
|
|
219
|
+
* conversion is the schema's too: the display name trimmed, the username folded.
|
|
220
|
+
*/
|
|
221
|
+
const userCreate = (body) => {
|
|
222
|
+
const displayName = trimmedName('displayName', requiredField('displayName', body.displayName));
|
|
223
|
+
const username = alphanumeric('username', requiredField('username', body.username).toLowerCase(), 3, 16);
|
|
224
|
+
const password = lengthBetween('password', requiredField('password', body.password), 6, 1024);
|
|
225
|
+
// the flags before `autoExec`, which is where `registerUserValidation` declares
|
|
226
|
+
// them, and both before the unknown keys, which Joi reports last of all
|
|
227
|
+
const isAdmin = booleanOf(body.isAdmin, 'isAdmin');
|
|
228
|
+
const isActive = booleanOf(body.isActive, 'isActive');
|
|
229
|
+
const autoExec = body.autoExec === undefined
|
|
230
|
+
? undefined
|
|
231
|
+
: stringField('autoExec', body.autoExec, true);
|
|
232
|
+
refuseUnknown(body, USER_KEYS);
|
|
233
|
+
return { displayName, username, password, isAdmin, isActive, autoExec };
|
|
234
|
+
};
|
|
235
|
+
const GROUP_CREATE_KEYS = ['name', 'description', 'isActive'];
|
|
236
|
+
/** `registerGroupValidation`, in its order and its wording. */
|
|
237
|
+
const groupCreate = (body) => {
|
|
238
|
+
// a group's name is a label rather than a login handle, so it is not folded
|
|
239
|
+
const name = alphanumeric('name', requiredField('name', body.name), 3, 16);
|
|
240
|
+
const description = body.description === undefined
|
|
241
|
+
? undefined
|
|
242
|
+
: stringField('description', body.description);
|
|
243
|
+
// as in `userCreate`: the flag first, the unknown keys last, which is the order
|
|
244
|
+
// the schema reports them in
|
|
245
|
+
const isActive = booleanOf(body.isActive, 'isActive');
|
|
246
|
+
refuseUnknown(body, GROUP_CREATE_KEYS);
|
|
247
|
+
return { name, description, isActive };
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* `updateUserValidation`, in its order and its wording.
|
|
251
|
+
*
|
|
252
|
+
* Every string here is optional, because an update may carry nothing but the flag
|
|
253
|
+
* it is changing - the document's `required` flags are tsoa's, not the schema's.
|
|
254
|
+
* The two flags themselves are declared only for an administrator, so a non-admin
|
|
255
|
+
* that sends one is refused as an unknown key, as is any key the schema omits.
|
|
256
|
+
*/
|
|
257
|
+
const userUpdate = (body, admin) => {
|
|
258
|
+
const changes = { ...body };
|
|
259
|
+
if (changes.displayName !== undefined)
|
|
260
|
+
changes.displayName = trimmedName('displayName', stringField('displayName', changes.displayName));
|
|
261
|
+
if (changes.username !== undefined)
|
|
262
|
+
changes.username = alphanumeric('username', stringField('username', changes.username).toLowerCase(), 3, 16);
|
|
263
|
+
if (changes.password !== undefined)
|
|
264
|
+
lengthBetween('password', stringField('password', changes.password), 6, 1024);
|
|
265
|
+
if (changes.autoExec !== undefined)
|
|
266
|
+
stringField('autoExec', changes.autoExec, true);
|
|
267
|
+
// On a non-admin's own update the schema declares neither flag, so the two are
|
|
268
|
+
// unknown keys like any other - and `refuseUnknown` reports whichever the body
|
|
269
|
+
// states first, which is the order Joi reports them in. Reporting them ahead of
|
|
270
|
+
// that loop would answer `"isAdmin" is not allowed` to a body whose first
|
|
271
|
+
// unknown key is something else.
|
|
272
|
+
const declared = admin
|
|
273
|
+
? USER_KEYS
|
|
274
|
+
: USER_KEYS.filter((key) => key !== 'isAdmin' && key !== 'isActive');
|
|
275
|
+
for (const field of ['isAdmin', 'isActive'])
|
|
276
|
+
if (admin && field in changes)
|
|
277
|
+
changes[field] = booleanOf(changes[field], field);
|
|
278
|
+
refuseUnknown(changes, declared);
|
|
279
|
+
return changes;
|
|
280
|
+
};
|
|
105
281
|
/**
|
|
106
282
|
* A body field the document states as a boolean, read the way the server reads it.
|
|
107
283
|
*
|
|
108
|
-
* The server validates
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
284
|
+
* The server validates these with `Joi.boolean()`, which converts real booleans
|
|
285
|
+
* and the string spellings of them - case-insensitively, and trimmed, as Joi 18
|
|
286
|
+
* does - and refuses every other shape. Both halves are reproduced here: a client
|
|
287
|
+
* that sent the string `"false"` and had its buffer laid out anyway, or an
|
|
288
|
+
* `isAdmin` of `"yes"` and had it stored, would find two hosts disagreeing about
|
|
289
|
+
* what it asked for.
|
|
290
|
+
*
|
|
291
|
+
* The conversion is limited to strings on purpose. `String(value)` would also read
|
|
292
|
+
* shapes the schema refuses - a one-element array `["true"]` stringifies to
|
|
293
|
+
* `'true'` - so a non-string, non-boolean value is not looked at, it is refused.
|
|
294
|
+
*
|
|
295
|
+
* A value that cannot be read is refused rather than guessed at, with the answer an
|
|
296
|
+
* installation gives it: `"yes"` is a caller's bug, and reading it as the default
|
|
297
|
+
* leaves that bug unanswered. `replaceOf` refuses its own boolean field for the
|
|
298
|
+
* same reason, though not by the same rules - an empty string there means the query
|
|
299
|
+
* parameter was not stated, and for a body field the schema refuses it.
|
|
116
300
|
*/
|
|
117
|
-
const
|
|
301
|
+
const booleanOf = (value, field) => {
|
|
302
|
+
if (value === undefined)
|
|
303
|
+
return undefined;
|
|
118
304
|
if (typeof value === 'boolean')
|
|
119
305
|
return value;
|
|
120
|
-
if (value === '
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
306
|
+
if (typeof value === 'string') {
|
|
307
|
+
const text = value.trim().toLowerCase();
|
|
308
|
+
if (text === 'true')
|
|
309
|
+
return true;
|
|
310
|
+
if (text === 'false')
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
throw new ApiError(400, `"${field}" must be a boolean`);
|
|
125
314
|
};
|
|
126
315
|
/**
|
|
127
316
|
* An app the index does not hold, in the wording the route answers with.
|
|
@@ -254,7 +443,6 @@ export const dispatch = async (services, routeId, request = {}) => {
|
|
|
254
443
|
!(await records.mayUseRoute(callerSubject, grantScoped)))
|
|
255
444
|
throw new ApiError(401, 'Unauthorized');
|
|
256
445
|
}
|
|
257
|
-
validate(route, request);
|
|
258
446
|
const query = request.query || {};
|
|
259
447
|
const body = request.body || {};
|
|
260
448
|
const params = request.params || {};
|
|
@@ -298,11 +486,113 @@ export const dispatch = async (services, routeId, request = {}) => {
|
|
|
298
486
|
status: 200,
|
|
299
487
|
contents: output.contents
|
|
300
488
|
});
|
|
489
|
+
/**
|
|
490
|
+
* The caller's own record, as the administration routes read it.
|
|
491
|
+
*
|
|
492
|
+
* The user routes ask two questions about the caller before they look at the
|
|
493
|
+
* body - who is this, and are they an administrator - because an installation
|
|
494
|
+
* mounts `authenticateAccessToken` and `verifyAdmin`/`verifyAdminIfNeeded`
|
|
495
|
+
* ahead of the schema. The store's own refusal travels from here rather than
|
|
496
|
+
* being folded into "not an admin": a caller it does not hold is refused
|
|
497
|
+
* `Unauthorized`, which is the answer the token gate gives.
|
|
498
|
+
*/
|
|
499
|
+
const callerRecord = async () => {
|
|
500
|
+
const recordsService = required();
|
|
501
|
+
const subject = await caller();
|
|
502
|
+
return recordsService.getUser(subject, {
|
|
503
|
+
uid: String(subject?.userId ?? '')
|
|
504
|
+
});
|
|
505
|
+
};
|
|
506
|
+
/**
|
|
507
|
+
* `verifyAdminIfNeeded`: the caller is an administrator, or the account the
|
|
508
|
+
* route names is their own. Answers whether they are an administrator, which
|
|
509
|
+
* is what the schema is built with on an installation.
|
|
510
|
+
*/
|
|
511
|
+
const verifyAdminIfNeeded = async (target) => {
|
|
512
|
+
const me = await callerRecord();
|
|
513
|
+
if (me.isAdmin)
|
|
514
|
+
return true;
|
|
515
|
+
const ownAccount = (target.uid !== undefined && target.uid === me.uid) ||
|
|
516
|
+
(target.username !== undefined && target.username === me.username);
|
|
517
|
+
if (!ownAccount)
|
|
518
|
+
throw new ApiError(401, 'Admin account required');
|
|
519
|
+
return false;
|
|
520
|
+
};
|
|
301
521
|
const required = () => {
|
|
302
522
|
if (!records)
|
|
303
523
|
throw new ApiError(501, `This host has no record service, so it cannot answer ${routeId}.`);
|
|
304
524
|
return records;
|
|
305
525
|
};
|
|
526
|
+
/**
|
|
527
|
+
* The routes whose caller gate and body rules belong to the controller.
|
|
528
|
+
*
|
|
529
|
+
* An installation mounts `authenticateAccessToken`, then `verifyAdmin` or
|
|
530
|
+
* `verifyAdminIfNeeded`, and only then the schema - so on these routes the caller
|
|
531
|
+
* is refused before a field is read. And on the update and delete routes the
|
|
532
|
+
* schema is `updateUserValidation`'s or `deleteUserValidation`'s rather than the
|
|
533
|
+
* document's: every string on an update is optional, the two flags are declared
|
|
534
|
+
* only for an administrator, and a deletion carries the caller's password, which
|
|
535
|
+
* is checked against the password schema before it is compared.
|
|
536
|
+
*
|
|
537
|
+
* One entry per route answers both questions and hands back the body to apply, so
|
|
538
|
+
* the gate and the field rules it belongs with cannot drift apart, and the shared
|
|
539
|
+
* `validate` - which knows only what the document states - is skipped for exactly
|
|
540
|
+
* these routes rather than for a list that has to agree with the switch below.
|
|
541
|
+
*/
|
|
542
|
+
const controllerRules = {
|
|
543
|
+
'POST /SASjsApi/user': async (request) => {
|
|
544
|
+
if (!(await callerRecord()).isAdmin)
|
|
545
|
+
throw new ApiError(401, 'Admin account required');
|
|
546
|
+
return { body: userCreate(request.body || {}) };
|
|
547
|
+
},
|
|
548
|
+
'POST /SASjsApi/group': async (request) => {
|
|
549
|
+
if (!(await callerRecord()).isAdmin)
|
|
550
|
+
throw new ApiError(401, 'Admin account required');
|
|
551
|
+
return { body: groupCreate(request.body || {}) };
|
|
552
|
+
},
|
|
553
|
+
'PATCH /SASjsApi/user/{uid}': async (request) => {
|
|
554
|
+
const admin = await verifyAdminIfNeeded({
|
|
555
|
+
uid: String(request.params?.uid ?? '')
|
|
556
|
+
});
|
|
557
|
+
return { body: userUpdate(request.body || {}, admin) };
|
|
558
|
+
},
|
|
559
|
+
'PATCH /SASjsApi/user/by/username/{username}': async (request) => {
|
|
560
|
+
// the gate compares the raw parameter, as the server's does, and the schema
|
|
561
|
+
// checks it before the body is read
|
|
562
|
+
const admin = await verifyAdminIfNeeded({
|
|
563
|
+
username: String(request.params?.username ?? '')
|
|
564
|
+
});
|
|
565
|
+
const username = foldedUsername(request.params?.username);
|
|
566
|
+
return { body: userUpdate(request.body || {}, admin), username };
|
|
567
|
+
},
|
|
568
|
+
'DELETE /SASjsApi/user/by/username/{username}': async (request) => {
|
|
569
|
+
const admin = await verifyAdminIfNeeded({
|
|
570
|
+
username: String(request.params?.username ?? '')
|
|
571
|
+
});
|
|
572
|
+
// the parameter is checked before the body, as `getUserValidation` is mounted
|
|
573
|
+
// ahead of the deletion's own schema
|
|
574
|
+
const username = foldedUsername(request.params?.username);
|
|
575
|
+
return { body: deletionBody(request.body || {}, admin), username };
|
|
576
|
+
},
|
|
577
|
+
'DELETE /SASjsApi/user/{uid}': async (request) => {
|
|
578
|
+
const admin = await verifyAdminIfNeeded({
|
|
579
|
+
uid: String(request.params?.uid ?? '')
|
|
580
|
+
});
|
|
581
|
+
return { body: deletionBody(request.body || {}, admin) };
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
const controllerRule = controllerRules[routeId];
|
|
585
|
+
const controllerAnswer = controllerRule
|
|
586
|
+
? await controllerRule(request)
|
|
587
|
+
: undefined;
|
|
588
|
+
// the routes a controller owns were validated above, after their gate; the
|
|
589
|
+
// admin mounts refuse the caller before the schema, and everything else takes
|
|
590
|
+
// the document's checks as they come
|
|
591
|
+
if (!controllerRule) {
|
|
592
|
+
if (ADMIN_GATED_ROUTES.has(routeId) && !(await callerRecord()).isAdmin)
|
|
593
|
+
throw new ApiError(401, 'Admin account required');
|
|
594
|
+
validate(route, request);
|
|
595
|
+
}
|
|
306
596
|
if (routeId.startsWith('POST /SASjsApi/auth/') ||
|
|
307
597
|
routeId.startsWith('POST /SASLogon/') ||
|
|
308
598
|
routeId === 'GET /SASLogon/logout' ||
|
|
@@ -735,40 +1025,36 @@ export const dispatch = async (services, routeId, request = {}) => {
|
|
|
735
1025
|
return {
|
|
736
1026
|
status: 200,
|
|
737
1027
|
body: await required().getUser(await caller(), {
|
|
738
|
-
username:
|
|
1028
|
+
username: foldedUsername(params.username)
|
|
739
1029
|
})
|
|
740
1030
|
};
|
|
741
1031
|
case 'POST /SASjsApi/user':
|
|
742
1032
|
return {
|
|
743
1033
|
status: 200,
|
|
744
|
-
body: await required().createUser(await caller(),
|
|
745
|
-
username: String(body.username ?? ''),
|
|
746
|
-
displayName: String(body.displayName ?? ''),
|
|
747
|
-
password: String(body.password ?? ''),
|
|
748
|
-
isAdmin: body.isAdmin,
|
|
749
|
-
isActive: body.isActive,
|
|
750
|
-
autoExec: body.autoExec
|
|
751
|
-
})
|
|
1034
|
+
body: await required().createUser(await caller(), controllerAnswer.body)
|
|
752
1035
|
};
|
|
753
1036
|
case 'PATCH /SASjsApi/user/{uid}':
|
|
754
1037
|
return {
|
|
755
1038
|
status: 200,
|
|
756
|
-
body: await required().updateUser(await caller(), { uid: String(params.uid ?? '') },
|
|
1039
|
+
body: await required().updateUser(await caller(), { uid: String(params.uid ?? '') },
|
|
1040
|
+
// the body the controller's own schema accepted, with what Joi converts
|
|
1041
|
+
// already converted
|
|
1042
|
+
controllerAnswer.body)
|
|
757
1043
|
};
|
|
758
1044
|
case 'PATCH /SASjsApi/user/by/username/{username}':
|
|
759
1045
|
return {
|
|
760
1046
|
status: 200,
|
|
761
|
-
body: await required().updateUser(await caller(), { username:
|
|
1047
|
+
body: await required().updateUser(await caller(), { username: controllerAnswer.username ?? '' }, controllerAnswer.body)
|
|
762
1048
|
};
|
|
763
1049
|
case 'DELETE /SASjsApi/user/{uid}':
|
|
764
1050
|
return {
|
|
765
1051
|
status: 200,
|
|
766
|
-
body: await required().deleteUser(await caller(), { uid: String(params.uid ?? '') }, { password: body.password })
|
|
1052
|
+
body: await required().deleteUser(await caller(), { uid: String(params.uid ?? '') }, { password: controllerAnswer.body.password })
|
|
767
1053
|
};
|
|
768
1054
|
case 'DELETE /SASjsApi/user/by/username/{username}':
|
|
769
1055
|
return {
|
|
770
1056
|
status: 200,
|
|
771
|
-
body: await required().deleteUser(await caller(), { username:
|
|
1057
|
+
body: await required().deleteUser(await caller(), { username: controllerAnswer.username ?? '' }, { password: body.password })
|
|
772
1058
|
};
|
|
773
1059
|
case 'POST /SASjsApi/code/lint':
|
|
774
1060
|
if (!code)
|
|
@@ -790,7 +1076,7 @@ export const dispatch = async (services, routeId, request = {}) => {
|
|
|
790
1076
|
filePath: body.filePath,
|
|
791
1077
|
// the body is rebuilt field by field here, so a flag the service reads
|
|
792
1078
|
// has to be named or the request's own answer is lost on the way
|
|
793
|
-
layout:
|
|
1079
|
+
layout: booleanOf(body.layout, 'layout')
|
|
794
1080
|
})
|
|
795
1081
|
};
|
|
796
1082
|
case 'GET /SASjsApi/info/authorizedRoutes':
|
|
@@ -823,9 +1109,10 @@ export const dispatch = async (services, routeId, request = {}) => {
|
|
|
823
1109
|
return {
|
|
824
1110
|
status: 200,
|
|
825
1111
|
body: await required().createGroup(await caller(), {
|
|
826
|
-
name: String(body.name ?? ''),
|
|
827
|
-
|
|
828
|
-
|
|
1112
|
+
name: String(controllerAnswer.body.name ?? ''),
|
|
1113
|
+
// left absent rather than made empty: the service applies the model's default
|
|
1114
|
+
description: controllerAnswer.body.description,
|
|
1115
|
+
isActive: controllerAnswer.body.isActive
|
|
829
1116
|
})
|
|
830
1117
|
};
|
|
831
1118
|
case 'POST /SASjsApi/group/{groupUid}/{userUid}':
|
|
@@ -86,7 +86,7 @@ export interface RecordService {
|
|
|
86
86
|
}): Promise<GroupDetailsResponse>;
|
|
87
87
|
createGroup(caller: Subject | undefined, body: {
|
|
88
88
|
name: string;
|
|
89
|
-
description
|
|
89
|
+
description?: string;
|
|
90
90
|
isActive?: boolean;
|
|
91
91
|
}): Promise<GroupDetailsResponse>;
|
|
92
92
|
deleteGroup(caller: Subject | undefined, uid: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../../src/identity/records.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EACV,oBAAoB,EAGpB,aAAa,EAEb,OAAO,EACR,MAAM,YAAY,CAAA;AAEnB,iFAAiF;AACjF,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,mBAAoB,SAAQ,YAAY;IACvD,QAAQ,EAAE,OAAO,CAAA;IACjB,qBAAqB,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAC9D;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,oBAAqB,SAAQ,aAAa;IACzD,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,YAAY,EAAE,CAAA;CACtB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,2EAA2E;IAC3E,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;IAC9B,gBAAgB,CACd,MAAM,EAAE,OAAO,GAAG,SAAS,EAC3B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GACxB,OAAO,CAAC,kBAAkB,CAAC,CAAA;IAC9B,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAE3E,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAA;IACzE,YAAY,CACV,MAAM,EAAE,OAAO,GAAG,SAAS,EAC3B,IAAI,EAAE,oBAAoB,GACzB,OAAO,CAAC,oBAAoB,CAAC,CAAA;IAEhC,wEAAwE;IACxE,cAAc,CACZ,MAAM,EAAE,OAAO,GAAG,SAAS,EAC3B,IAAI,EAAE;QAAE,eAAe,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GACrD,OAAO,CAAC,IAAI,CAAC,CAAA;CACjB;AAiFD,eAAO,MAAM,mBAAmB,GAAI,OAAO,OAAO,KAAG,MAKf,CAAA;AAetC,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;CAC3B;AAED,eAAO,MAAM,mBAAmB,GAC9B,OAAO,aAAa,EACpB,UAAS,oBAAyB,KACjC,aAsgBF,CAAA"}
|
|
@@ -221,8 +221,9 @@ export const createRecordService = (store, options = {}) => {
|
|
|
221
221
|
throw new ApiError(409, 'Username already exists.');
|
|
222
222
|
change.username = body.username;
|
|
223
223
|
}
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
// the controller always puts the sanitised name in the update, so an update
|
|
225
|
+
// that omits one stores the empty string rather than keeping the old name
|
|
226
|
+
change.displayName = displayName;
|
|
226
227
|
if (body.isAdmin !== undefined)
|
|
227
228
|
change.isAdmin = body.isAdmin;
|
|
228
229
|
if (body.isActive !== undefined)
|
|
@@ -277,7 +278,8 @@ export const createRecordService = (store, options = {}) => {
|
|
|
277
278
|
throw new ApiError(409, 'Group name already exists.');
|
|
278
279
|
const created = await store.createGroup({
|
|
279
280
|
name: body.name,
|
|
280
|
-
description
|
|
281
|
+
// the model defaults the field, so an absent description is the model's
|
|
282
|
+
description: body.description ?? 'Group description.',
|
|
281
283
|
isActive: body.isActive !== false
|
|
282
284
|
});
|
|
283
285
|
return groupDetails(created);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generated.d.ts","sourceRoot":"","sources":["../../../src/routes/generated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,eAAO,MAAM,gBAAgB,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"generated.d.ts","sourceRoot":"","sources":["../../../src/routes/generated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,eAAO,MAAM,gBAAgB,EAAE,cAAc,EAmtE5C,CAAA"}
|
|
@@ -1092,7 +1092,7 @@ export const GENERATED_ROUTES = [
|
|
|
1092
1092
|
{
|
|
1093
1093
|
name: 'description',
|
|
1094
1094
|
in: 'body',
|
|
1095
|
-
required:
|
|
1095
|
+
required: false,
|
|
1096
1096
|
type: 'string'
|
|
1097
1097
|
},
|
|
1098
1098
|
{
|
|
@@ -1108,6 +1108,10 @@ export const GENERATED_ROUTES = [
|
|
|
1108
1108
|
status: 200,
|
|
1109
1109
|
description: 'Ok'
|
|
1110
1110
|
},
|
|
1111
|
+
{
|
|
1112
|
+
status: 400,
|
|
1113
|
+
description: 'A body the schema refuses, e.g. `"isActive" must be a boolean`.'
|
|
1114
|
+
},
|
|
1111
1115
|
{
|
|
1112
1116
|
status: 401,
|
|
1113
1117
|
description: 'Admin account required'
|
|
@@ -1806,6 +1810,10 @@ export const GENERATED_ROUTES = [
|
|
|
1806
1810
|
status: 200,
|
|
1807
1811
|
description: 'Ok'
|
|
1808
1812
|
},
|
|
1813
|
+
{
|
|
1814
|
+
status: 400,
|
|
1815
|
+
description: 'A body the schema refuses, e.g. `"isAdmin" must be a boolean`.'
|
|
1816
|
+
},
|
|
1809
1817
|
{
|
|
1810
1818
|
status: 401,
|
|
1811
1819
|
description: 'Admin account required'
|
|
@@ -1842,6 +1850,10 @@ export const GENERATED_ROUTES = [
|
|
|
1842
1850
|
status: 200,
|
|
1843
1851
|
description: 'Account Deleted!'
|
|
1844
1852
|
},
|
|
1853
|
+
{
|
|
1854
|
+
status: 400,
|
|
1855
|
+
description: 'A password shorter than six characters, or a key the deletion takes none of; e.g. `"password" is required`'
|
|
1856
|
+
},
|
|
1845
1857
|
{
|
|
1846
1858
|
status: 401,
|
|
1847
1859
|
description: 'Admin account required, or invalid password'
|
|
@@ -1898,19 +1910,19 @@ export const GENERATED_ROUTES = [
|
|
|
1898
1910
|
{
|
|
1899
1911
|
name: 'displayName',
|
|
1900
1912
|
in: 'body',
|
|
1901
|
-
required:
|
|
1913
|
+
required: false,
|
|
1902
1914
|
type: 'string'
|
|
1903
1915
|
},
|
|
1904
1916
|
{
|
|
1905
1917
|
name: 'username',
|
|
1906
1918
|
in: 'body',
|
|
1907
|
-
required:
|
|
1919
|
+
required: false,
|
|
1908
1920
|
type: 'string'
|
|
1909
1921
|
},
|
|
1910
1922
|
{
|
|
1911
1923
|
name: 'password',
|
|
1912
1924
|
in: 'body',
|
|
1913
|
-
required:
|
|
1925
|
+
required: false,
|
|
1914
1926
|
type: 'string'
|
|
1915
1927
|
},
|
|
1916
1928
|
{
|
|
@@ -1938,6 +1950,10 @@ export const GENERATED_ROUTES = [
|
|
|
1938
1950
|
status: 200,
|
|
1939
1951
|
description: 'Ok'
|
|
1940
1952
|
},
|
|
1953
|
+
{
|
|
1954
|
+
status: 400,
|
|
1955
|
+
description: 'A body the schema refuses, e.g. `"isAdmin" must be a boolean`.'
|
|
1956
|
+
},
|
|
1941
1957
|
{
|
|
1942
1958
|
status: 401,
|
|
1943
1959
|
description: 'Admin account required'
|
|
@@ -1982,6 +1998,10 @@ export const GENERATED_ROUTES = [
|
|
|
1982
1998
|
status: 200,
|
|
1983
1999
|
description: 'Account Deleted!'
|
|
1984
2000
|
},
|
|
2001
|
+
{
|
|
2002
|
+
status: 400,
|
|
2003
|
+
description: 'A username the schema refuses, a password shorter than six characters, or a key an administrator\'s deletion takes none of; e.g. `"password" is required`'
|
|
2004
|
+
},
|
|
1985
2005
|
{
|
|
1986
2006
|
status: 401,
|
|
1987
2007
|
description: 'Admin account required, or invalid password'
|
|
@@ -2012,6 +2032,10 @@ export const GENERATED_ROUTES = [
|
|
|
2012
2032
|
status: 200,
|
|
2013
2033
|
description: 'Ok'
|
|
2014
2034
|
},
|
|
2035
|
+
{
|
|
2036
|
+
status: 400,
|
|
2037
|
+
description: 'A username the schema refuses, e.g. `"username" must only contain alpha-numeric characters`'
|
|
2038
|
+
},
|
|
2015
2039
|
{
|
|
2016
2040
|
status: 401,
|
|
2017
2041
|
description: 'Unauthorized'
|
|
@@ -2038,19 +2062,19 @@ export const GENERATED_ROUTES = [
|
|
|
2038
2062
|
{
|
|
2039
2063
|
name: 'displayName',
|
|
2040
2064
|
in: 'body',
|
|
2041
|
-
required:
|
|
2065
|
+
required: false,
|
|
2042
2066
|
type: 'string'
|
|
2043
2067
|
},
|
|
2044
2068
|
{
|
|
2045
2069
|
name: 'username',
|
|
2046
2070
|
in: 'body',
|
|
2047
|
-
required:
|
|
2071
|
+
required: false,
|
|
2048
2072
|
type: 'string'
|
|
2049
2073
|
},
|
|
2050
2074
|
{
|
|
2051
2075
|
name: 'password',
|
|
2052
2076
|
in: 'body',
|
|
2053
|
-
required:
|
|
2077
|
+
required: false,
|
|
2054
2078
|
type: 'string'
|
|
2055
2079
|
},
|
|
2056
2080
|
{
|
|
@@ -2078,6 +2102,10 @@ export const GENERATED_ROUTES = [
|
|
|
2078
2102
|
status: 200,
|
|
2079
2103
|
description: 'Ok'
|
|
2080
2104
|
},
|
|
2105
|
+
{
|
|
2106
|
+
status: 400,
|
|
2107
|
+
description: 'A body the schema refuses, e.g. `"isAdmin" must be a boolean`.'
|
|
2108
|
+
},
|
|
2081
2109
|
{
|
|
2082
2110
|
status: 401,
|
|
2083
2111
|
description: 'Admin account required'
|
package/package.json
CHANGED