@sasjs/api 0.7.1 → 0.8.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/build/browser.js +63 -133
- package/build/cjs/corpus/records.js +22 -84
- package/build/cjs/host/dispatch.js +12 -6
- package/build/cjs/identity/fixture.js +1 -1
- package/build/cjs/identity/records.js +12 -19
- package/build/cjs/routes/generated.js +6 -6
- package/build/cjs/routes/overlay.js +0 -7
- package/build/esm/corpus/records.d.ts.map +1 -1
- package/build/esm/corpus/records.js +22 -84
- package/build/esm/host/dispatch.d.ts.map +1 -1
- package/build/esm/host/dispatch.js +12 -6
- package/build/esm/identity/fixture.js +1 -1
- package/build/esm/identity/records.d.ts +15 -4
- package/build/esm/identity/records.d.ts.map +1 -1
- package/build/esm/identity/records.js +12 -19
- package/build/esm/routes/generated.js +6 -6
- package/build/esm/routes/overlay.d.ts.map +1 -1
- package/build/esm/routes/overlay.js +0 -7
- package/package.json +1 -1
package/build/browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @sasjs/api 0.
|
|
1
|
+
/* @sasjs/api 0.8.0 - the SASjs Server API, for a service worker. https://github.com/sasjs/api */
|
|
2
2
|
"use strict";
|
|
3
3
|
var SASjsApi = (() => {
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1736,8 +1736,8 @@ var SASjsApi = (() => {
|
|
|
1736
1736
|
requestBodies: [],
|
|
1737
1737
|
responses: [
|
|
1738
1738
|
{
|
|
1739
|
-
status:
|
|
1740
|
-
description: "
|
|
1739
|
+
status: 200,
|
|
1740
|
+
description: "Permission Deleted!"
|
|
1741
1741
|
},
|
|
1742
1742
|
{
|
|
1743
1743
|
status: 401,
|
|
@@ -2080,8 +2080,8 @@ var SASjsApi = (() => {
|
|
|
2080
2080
|
requestBodies: ["application/json"],
|
|
2081
2081
|
responses: [
|
|
2082
2082
|
{
|
|
2083
|
-
status:
|
|
2084
|
-
description: "
|
|
2083
|
+
status: 200,
|
|
2084
|
+
description: "Account Deleted!"
|
|
2085
2085
|
},
|
|
2086
2086
|
{
|
|
2087
2087
|
status: 401,
|
|
@@ -2220,8 +2220,8 @@ var SASjsApi = (() => {
|
|
|
2220
2220
|
requestBodies: ["application/json"],
|
|
2221
2221
|
responses: [
|
|
2222
2222
|
{
|
|
2223
|
-
status:
|
|
2224
|
-
description: "
|
|
2223
|
+
status: 200,
|
|
2224
|
+
description: "Account Deleted!"
|
|
2225
2225
|
},
|
|
2226
2226
|
{
|
|
2227
2227
|
status: 401,
|
|
@@ -2626,13 +2626,6 @@ var SASjsApi = (() => {
|
|
|
2626
2626
|
},
|
|
2627
2627
|
"POST /SASjsApi/permission": { implemented: true },
|
|
2628
2628
|
"PATCH /SASjsApi/permission/{uid}": { implemented: true },
|
|
2629
|
-
// The three deletes answer 204 here and 200 on the wire: the server's route
|
|
2630
|
-
// handlers send `res.status(200).send('Account Deleted!')` and
|
|
2631
|
-
// `'Permission Deleted!'`, while tsoa emitted 204 for a void handler, so the
|
|
2632
|
-
// document understates the status. Correcting it is a decorator in
|
|
2633
|
-
// sasjs/server (`@SuccessResponse('200', ...)`), and this package follows the
|
|
2634
|
-
// document until that release lands - a local 200 would fail the schema check
|
|
2635
|
-
// that keeps this table honest.
|
|
2636
2629
|
"DELETE /SASjsApi/permission/{uid}": { implemented: true },
|
|
2637
2630
|
// Session - the caller's own session, then the record behind a triggered one
|
|
2638
2631
|
"GET /SASjsApi/session": {
|
|
@@ -2960,19 +2953,23 @@ var SASjsApi = (() => {
|
|
|
2960
2953
|
)
|
|
2961
2954
|
};
|
|
2962
2955
|
case "DELETE /SASjsApi/user/{uid}":
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2956
|
+
return {
|
|
2957
|
+
status: 200,
|
|
2958
|
+
body: await required().deleteUser(
|
|
2959
|
+
await caller(),
|
|
2960
|
+
{ uid: String(params.uid ?? "") },
|
|
2961
|
+
{ password: body.password }
|
|
2962
|
+
)
|
|
2963
|
+
};
|
|
2969
2964
|
case "DELETE /SASjsApi/user/by/username/{username}":
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2965
|
+
return {
|
|
2966
|
+
status: 200,
|
|
2967
|
+
body: await required().deleteUser(
|
|
2968
|
+
await caller(),
|
|
2969
|
+
{ username: String(params.username ?? "") },
|
|
2970
|
+
{ password: body.password }
|
|
2971
|
+
)
|
|
2972
|
+
};
|
|
2976
2973
|
case "GET /SASjsApi/group":
|
|
2977
2974
|
return { status: 200, body: await required().listGroups(await caller()) };
|
|
2978
2975
|
case "GET /SASjsApi/group/{uid}":
|
|
@@ -3045,11 +3042,13 @@ var SASjsApi = (() => {
|
|
|
3045
3042
|
)
|
|
3046
3043
|
};
|
|
3047
3044
|
case "DELETE /SASjsApi/permission/{uid}":
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3045
|
+
return {
|
|
3046
|
+
status: 200,
|
|
3047
|
+
body: await required().deletePermission(
|
|
3048
|
+
await caller(),
|
|
3049
|
+
String(params.uid ?? "")
|
|
3050
|
+
)
|
|
3051
|
+
};
|
|
3053
3052
|
case "GET /SASjsApi/client":
|
|
3054
3053
|
return { status: 200, body: await required().listClients(await caller()) };
|
|
3055
3054
|
case "POST /SASjsApi/client":
|
|
@@ -3267,23 +3266,14 @@ var SASjsApi = (() => {
|
|
|
3267
3266
|
return details;
|
|
3268
3267
|
};
|
|
3269
3268
|
const findBy = async (by) => by.uid !== void 0 ? store.userById(by.uid) : store.userByName(by.username ?? "");
|
|
3270
|
-
const permissionDetails = async (permission) => {
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
}
|
|
3277
|
-
|
|
3278
|
-
const user3 = await store.userById(permission.user);
|
|
3279
|
-
if (user3) response.user = asUser(user3);
|
|
3280
|
-
}
|
|
3281
|
-
if (permission.group) {
|
|
3282
|
-
const group = await store.groupById(permission.group);
|
|
3283
|
-
if (group) response.group = await groupDetails(group);
|
|
3284
|
-
}
|
|
3285
|
-
return response;
|
|
3286
|
-
};
|
|
3269
|
+
const permissionDetails = async (permission) => ({
|
|
3270
|
+
uid: permission.uid,
|
|
3271
|
+
path: permission.path,
|
|
3272
|
+
type: permission.type,
|
|
3273
|
+
setting: permission.setting,
|
|
3274
|
+
...permission.user ? { user: permission.user } : {},
|
|
3275
|
+
...permission.group ? { group: permission.group } : {}
|
|
3276
|
+
});
|
|
3287
3277
|
return {
|
|
3288
3278
|
async listUsers(caller) {
|
|
3289
3279
|
await requireCaller(store, caller);
|
|
@@ -3358,6 +3348,7 @@ var SASjsApi = (() => {
|
|
|
3358
3348
|
throw new ApiError(401, "Invalid password.");
|
|
3359
3349
|
}
|
|
3360
3350
|
await store.deleteUser(current.uid);
|
|
3351
|
+
return "Account Deleted!";
|
|
3361
3352
|
},
|
|
3362
3353
|
async listGroups(caller) {
|
|
3363
3354
|
await requireCaller(store, caller);
|
|
@@ -3505,6 +3496,7 @@ var SASjsApi = (() => {
|
|
|
3505
3496
|
if (!await store.permissionById(uid))
|
|
3506
3497
|
throw new ApiError(404, "Permission not found.");
|
|
3507
3498
|
await store.deletePermission(uid);
|
|
3499
|
+
return "Permission Deleted!";
|
|
3508
3500
|
},
|
|
3509
3501
|
async listClients(caller) {
|
|
3510
3502
|
await requireAdmin(store, caller);
|
|
@@ -3582,7 +3574,7 @@ var SASjsApi = (() => {
|
|
|
3582
3574
|
permissions: [
|
|
3583
3575
|
{
|
|
3584
3576
|
uid: "rule-routes",
|
|
3585
|
-
path: "/SASjsApi/
|
|
3577
|
+
path: "/SASjsApi/drive/file",
|
|
3586
3578
|
type: "Route",
|
|
3587
3579
|
setting: "Grant",
|
|
3588
3580
|
group: "group-data-controller"
|
|
@@ -5015,7 +5007,7 @@ var SASjsApi = (() => {
|
|
|
5015
5007
|
description: "deletes an account as an administrator, without a password",
|
|
5016
5008
|
identity: ADMIN_SIGNED_IN,
|
|
5017
5009
|
request: { token: ADMIN, params: { uid: RESTRICTED_UID }, body: {} },
|
|
5018
|
-
expect: { status:
|
|
5010
|
+
expect: { status: 200, body: "Account Deleted!" }
|
|
5019
5011
|
},
|
|
5020
5012
|
{
|
|
5021
5013
|
id: "delete-user-not-admin",
|
|
@@ -5043,7 +5035,7 @@ var SASjsApi = (() => {
|
|
|
5043
5035
|
params: { username: "user2" },
|
|
5044
5036
|
body: {}
|
|
5045
5037
|
},
|
|
5046
|
-
expect: { status:
|
|
5038
|
+
expect: { status: 200, body: "Account Deleted!" }
|
|
5047
5039
|
},
|
|
5048
5040
|
{
|
|
5049
5041
|
id: "delete-user-by-username-wrong-password",
|
|
@@ -5053,7 +5045,7 @@ var SASjsApi = (() => {
|
|
|
5053
5045
|
request: {
|
|
5054
5046
|
token: RESTRICTED,
|
|
5055
5047
|
params: { username: "user2" },
|
|
5056
|
-
body: { password: "
|
|
5048
|
+
body: { password: "wrong123" }
|
|
5057
5049
|
},
|
|
5058
5050
|
expect: { status: 401, error: "Invalid password." }
|
|
5059
5051
|
},
|
|
@@ -5362,55 +5354,24 @@ var SASjsApi = (() => {
|
|
|
5362
5354
|
body: [
|
|
5363
5355
|
{
|
|
5364
5356
|
uid: "rule-routes",
|
|
5365
|
-
path: "/SASjsApi/
|
|
5357
|
+
path: "/SASjsApi/drive/file",
|
|
5366
5358
|
type: "Route",
|
|
5367
5359
|
setting: "Grant",
|
|
5368
|
-
group:
|
|
5369
|
-
uid: "group-data-controller",
|
|
5370
|
-
name: "DCGroup",
|
|
5371
|
-
description: "Data Controller users",
|
|
5372
|
-
isActive: true,
|
|
5373
|
-
users: [
|
|
5374
|
-
{
|
|
5375
|
-
uid: RESTRICTED_UID,
|
|
5376
|
-
username: "user2",
|
|
5377
|
-
displayName: "Demo User",
|
|
5378
|
-
isAdmin: false
|
|
5379
|
-
}
|
|
5380
|
-
]
|
|
5381
|
-
}
|
|
5360
|
+
group: "group-data-controller"
|
|
5382
5361
|
},
|
|
5383
5362
|
{
|
|
5384
5363
|
uid: "rule-execute",
|
|
5385
5364
|
path: "/SASjsApi/stp/execute",
|
|
5386
5365
|
type: "Route",
|
|
5387
5366
|
setting: "Grant",
|
|
5388
|
-
group:
|
|
5389
|
-
uid: "group-data-controller",
|
|
5390
|
-
name: "DCGroup",
|
|
5391
|
-
description: "Data Controller users",
|
|
5392
|
-
isActive: true,
|
|
5393
|
-
users: [
|
|
5394
|
-
{
|
|
5395
|
-
uid: RESTRICTED_UID,
|
|
5396
|
-
username: "user2",
|
|
5397
|
-
displayName: "Demo User",
|
|
5398
|
-
isAdmin: false
|
|
5399
|
-
}
|
|
5400
|
-
]
|
|
5401
|
-
}
|
|
5367
|
+
group: "group-data-controller"
|
|
5402
5368
|
},
|
|
5403
5369
|
{
|
|
5404
5370
|
uid: "rule-code",
|
|
5405
5371
|
path: "/SASjsApi/code/execute",
|
|
5406
5372
|
type: "Route",
|
|
5407
5373
|
setting: "Deny",
|
|
5408
|
-
user:
|
|
5409
|
-
uid: RESTRICTED_UID,
|
|
5410
|
-
username: "user2",
|
|
5411
|
-
displayName: "Demo User",
|
|
5412
|
-
isAdmin: false
|
|
5413
|
-
}
|
|
5374
|
+
user: RESTRICTED_UID
|
|
5414
5375
|
}
|
|
5415
5376
|
]
|
|
5416
5377
|
}
|
|
@@ -5426,55 +5387,24 @@ var SASjsApi = (() => {
|
|
|
5426
5387
|
body: [
|
|
5427
5388
|
{
|
|
5428
5389
|
uid: "rule-routes",
|
|
5429
|
-
path: "/SASjsApi/
|
|
5390
|
+
path: "/SASjsApi/drive/file",
|
|
5430
5391
|
type: "Route",
|
|
5431
5392
|
setting: "Grant",
|
|
5432
|
-
group:
|
|
5433
|
-
uid: "group-data-controller",
|
|
5434
|
-
name: "DCGroup",
|
|
5435
|
-
description: "Data Controller users",
|
|
5436
|
-
isActive: true,
|
|
5437
|
-
users: [
|
|
5438
|
-
{
|
|
5439
|
-
uid: RESTRICTED_UID,
|
|
5440
|
-
username: "user2",
|
|
5441
|
-
displayName: "Demo User",
|
|
5442
|
-
isAdmin: false
|
|
5443
|
-
}
|
|
5444
|
-
]
|
|
5445
|
-
}
|
|
5393
|
+
group: "group-data-controller"
|
|
5446
5394
|
},
|
|
5447
5395
|
{
|
|
5448
5396
|
uid: "rule-execute",
|
|
5449
5397
|
path: "/SASjsApi/stp/execute",
|
|
5450
5398
|
type: "Route",
|
|
5451
5399
|
setting: "Grant",
|
|
5452
|
-
group:
|
|
5453
|
-
uid: "group-data-controller",
|
|
5454
|
-
name: "DCGroup",
|
|
5455
|
-
description: "Data Controller users",
|
|
5456
|
-
isActive: true,
|
|
5457
|
-
users: [
|
|
5458
|
-
{
|
|
5459
|
-
uid: RESTRICTED_UID,
|
|
5460
|
-
username: "user2",
|
|
5461
|
-
displayName: "Demo User",
|
|
5462
|
-
isAdmin: false
|
|
5463
|
-
}
|
|
5464
|
-
]
|
|
5465
|
-
}
|
|
5400
|
+
group: "group-data-controller"
|
|
5466
5401
|
},
|
|
5467
5402
|
{
|
|
5468
5403
|
uid: "rule-code",
|
|
5469
5404
|
path: "/SASjsApi/code/execute",
|
|
5470
5405
|
type: "Route",
|
|
5471
5406
|
setting: "Deny",
|
|
5472
|
-
user:
|
|
5473
|
-
uid: RESTRICTED_UID,
|
|
5474
|
-
username: "user2",
|
|
5475
|
-
displayName: "Demo User",
|
|
5476
|
-
isAdmin: false
|
|
5477
|
-
}
|
|
5407
|
+
user: RESTRICTED_UID
|
|
5478
5408
|
}
|
|
5479
5409
|
]
|
|
5480
5410
|
}
|
|
@@ -5495,7 +5425,7 @@ var SASjsApi = (() => {
|
|
|
5495
5425
|
request: {
|
|
5496
5426
|
token: ADMIN,
|
|
5497
5427
|
body: {
|
|
5498
|
-
path: "/SASjsApi/
|
|
5428
|
+
path: "/SASjsApi/drive/folder",
|
|
5499
5429
|
type: "Route",
|
|
5500
5430
|
setting: "Grant",
|
|
5501
5431
|
principalType: "user",
|
|
@@ -5504,7 +5434,7 @@ var SASjsApi = (() => {
|
|
|
5504
5434
|
},
|
|
5505
5435
|
expect: {
|
|
5506
5436
|
status: 200,
|
|
5507
|
-
partial: { path: "/SASjsApi/
|
|
5437
|
+
partial: { path: "/SASjsApi/drive/folder", setting: "Grant" }
|
|
5508
5438
|
}
|
|
5509
5439
|
},
|
|
5510
5440
|
{
|
|
@@ -5515,7 +5445,7 @@ var SASjsApi = (() => {
|
|
|
5515
5445
|
request: {
|
|
5516
5446
|
token: ADMIN,
|
|
5517
5447
|
body: {
|
|
5518
|
-
path: "/SASjsApi/
|
|
5448
|
+
path: "/SASjsApi/drive/rename",
|
|
5519
5449
|
type: "Route",
|
|
5520
5450
|
setting: "Grant",
|
|
5521
5451
|
principalType: "group",
|
|
@@ -5525,9 +5455,9 @@ var SASjsApi = (() => {
|
|
|
5525
5455
|
expect: {
|
|
5526
5456
|
status: 200,
|
|
5527
5457
|
partial: {
|
|
5528
|
-
path: "/SASjsApi/
|
|
5458
|
+
path: "/SASjsApi/drive/rename",
|
|
5529
5459
|
setting: "Grant",
|
|
5530
|
-
group:
|
|
5460
|
+
group: "group-data-controller"
|
|
5531
5461
|
}
|
|
5532
5462
|
}
|
|
5533
5463
|
},
|
|
@@ -5539,7 +5469,7 @@ var SASjsApi = (() => {
|
|
|
5539
5469
|
request: {
|
|
5540
5470
|
token: ADMIN,
|
|
5541
5471
|
body: {
|
|
5542
|
-
path: "/SASjsApi/
|
|
5472
|
+
path: "/SASjsApi/drive/deploy",
|
|
5543
5473
|
type: "Route",
|
|
5544
5474
|
setting: "Grant",
|
|
5545
5475
|
principalType: "role",
|
|
@@ -5559,7 +5489,7 @@ var SASjsApi = (() => {
|
|
|
5559
5489
|
request: {
|
|
5560
5490
|
token: ADMIN,
|
|
5561
5491
|
body: {
|
|
5562
|
-
path: "/SASjsApi/
|
|
5492
|
+
path: "/SASjsApi/drive/folder",
|
|
5563
5493
|
type: "Route",
|
|
5564
5494
|
setting: "Grant",
|
|
5565
5495
|
principalType: "user",
|
|
@@ -5579,7 +5509,7 @@ var SASjsApi = (() => {
|
|
|
5579
5509
|
request: {
|
|
5580
5510
|
token: RESTRICTED,
|
|
5581
5511
|
body: {
|
|
5582
|
-
path: "/SASjsApi/
|
|
5512
|
+
path: "/SASjsApi/drive/folder",
|
|
5583
5513
|
type: "Route",
|
|
5584
5514
|
setting: "Grant",
|
|
5585
5515
|
principalType: "user",
|
|
@@ -5596,7 +5526,7 @@ var SASjsApi = (() => {
|
|
|
5596
5526
|
request: {
|
|
5597
5527
|
token: ADMIN,
|
|
5598
5528
|
body: {
|
|
5599
|
-
path: "/SASjsApi/
|
|
5529
|
+
path: "/SASjsApi/drive/rename",
|
|
5600
5530
|
type: "Route",
|
|
5601
5531
|
setting: "Grant",
|
|
5602
5532
|
principalType: "group",
|
|
@@ -5613,7 +5543,7 @@ var SASjsApi = (() => {
|
|
|
5613
5543
|
request: {
|
|
5614
5544
|
token: ADMIN,
|
|
5615
5545
|
body: {
|
|
5616
|
-
path: "/SASjsApi/
|
|
5546
|
+
path: "/SASjsApi/drive/file",
|
|
5617
5547
|
type: "Route",
|
|
5618
5548
|
setting: "Grant",
|
|
5619
5549
|
principalType: "group",
|
|
@@ -5687,7 +5617,7 @@ var SASjsApi = (() => {
|
|
|
5687
5617
|
description: "deletes a rule",
|
|
5688
5618
|
identity: ADMIN_SIGNED_IN,
|
|
5689
5619
|
request: { token: ADMIN, params: { uid: "rule-code" } },
|
|
5690
|
-
expect: { status:
|
|
5620
|
+
expect: { status: 200, body: "Permission Deleted!" }
|
|
5691
5621
|
},
|
|
5692
5622
|
{
|
|
5693
5623
|
id: "delete-permission-not-admin",
|
|
@@ -366,7 +366,7 @@ exports.RECORD_CORPUS = [
|
|
|
366
366
|
description: 'deletes an account as an administrator, without a password',
|
|
367
367
|
identity: exports.ADMIN_SIGNED_IN,
|
|
368
368
|
request: { token: ADMIN, params: { uid: RESTRICTED_UID }, body: {} },
|
|
369
|
-
expect: { status:
|
|
369
|
+
expect: { status: 200, body: 'Account Deleted!' }
|
|
370
370
|
},
|
|
371
371
|
{
|
|
372
372
|
id: 'delete-user-not-admin',
|
|
@@ -394,7 +394,7 @@ exports.RECORD_CORPUS = [
|
|
|
394
394
|
params: { username: 'user2' },
|
|
395
395
|
body: {}
|
|
396
396
|
},
|
|
397
|
-
expect: { status:
|
|
397
|
+
expect: { status: 200, body: 'Account Deleted!' }
|
|
398
398
|
},
|
|
399
399
|
{
|
|
400
400
|
id: 'delete-user-by-username-wrong-password',
|
|
@@ -404,7 +404,7 @@ exports.RECORD_CORPUS = [
|
|
|
404
404
|
request: {
|
|
405
405
|
token: RESTRICTED,
|
|
406
406
|
params: { username: 'user2' },
|
|
407
|
-
body: { password: '
|
|
407
|
+
body: { password: 'wrong123' }
|
|
408
408
|
},
|
|
409
409
|
expect: { status: 401, error: 'Invalid password.' }
|
|
410
410
|
},
|
|
@@ -713,55 +713,24 @@ exports.RECORD_CORPUS = [
|
|
|
713
713
|
body: [
|
|
714
714
|
{
|
|
715
715
|
uid: 'rule-routes',
|
|
716
|
-
path: '/SASjsApi/
|
|
716
|
+
path: '/SASjsApi/drive/file',
|
|
717
717
|
type: 'Route',
|
|
718
718
|
setting: 'Grant',
|
|
719
|
-
group:
|
|
720
|
-
uid: 'group-data-controller',
|
|
721
|
-
name: 'DCGroup',
|
|
722
|
-
description: 'Data Controller users',
|
|
723
|
-
isActive: true,
|
|
724
|
-
users: [
|
|
725
|
-
{
|
|
726
|
-
uid: RESTRICTED_UID,
|
|
727
|
-
username: 'user2',
|
|
728
|
-
displayName: 'Demo User',
|
|
729
|
-
isAdmin: false
|
|
730
|
-
}
|
|
731
|
-
]
|
|
732
|
-
}
|
|
719
|
+
group: 'group-data-controller'
|
|
733
720
|
},
|
|
734
721
|
{
|
|
735
722
|
uid: 'rule-execute',
|
|
736
723
|
path: '/SASjsApi/stp/execute',
|
|
737
724
|
type: 'Route',
|
|
738
725
|
setting: 'Grant',
|
|
739
|
-
group:
|
|
740
|
-
uid: 'group-data-controller',
|
|
741
|
-
name: 'DCGroup',
|
|
742
|
-
description: 'Data Controller users',
|
|
743
|
-
isActive: true,
|
|
744
|
-
users: [
|
|
745
|
-
{
|
|
746
|
-
uid: RESTRICTED_UID,
|
|
747
|
-
username: 'user2',
|
|
748
|
-
displayName: 'Demo User',
|
|
749
|
-
isAdmin: false
|
|
750
|
-
}
|
|
751
|
-
]
|
|
752
|
-
}
|
|
726
|
+
group: 'group-data-controller'
|
|
753
727
|
},
|
|
754
728
|
{
|
|
755
729
|
uid: 'rule-code',
|
|
756
730
|
path: '/SASjsApi/code/execute',
|
|
757
731
|
type: 'Route',
|
|
758
732
|
setting: 'Deny',
|
|
759
|
-
user:
|
|
760
|
-
uid: RESTRICTED_UID,
|
|
761
|
-
username: 'user2',
|
|
762
|
-
displayName: 'Demo User',
|
|
763
|
-
isAdmin: false
|
|
764
|
-
}
|
|
733
|
+
user: RESTRICTED_UID
|
|
765
734
|
}
|
|
766
735
|
]
|
|
767
736
|
}
|
|
@@ -777,55 +746,24 @@ exports.RECORD_CORPUS = [
|
|
|
777
746
|
body: [
|
|
778
747
|
{
|
|
779
748
|
uid: 'rule-routes',
|
|
780
|
-
path: '/SASjsApi/
|
|
749
|
+
path: '/SASjsApi/drive/file',
|
|
781
750
|
type: 'Route',
|
|
782
751
|
setting: 'Grant',
|
|
783
|
-
group:
|
|
784
|
-
uid: 'group-data-controller',
|
|
785
|
-
name: 'DCGroup',
|
|
786
|
-
description: 'Data Controller users',
|
|
787
|
-
isActive: true,
|
|
788
|
-
users: [
|
|
789
|
-
{
|
|
790
|
-
uid: RESTRICTED_UID,
|
|
791
|
-
username: 'user2',
|
|
792
|
-
displayName: 'Demo User',
|
|
793
|
-
isAdmin: false
|
|
794
|
-
}
|
|
795
|
-
]
|
|
796
|
-
}
|
|
752
|
+
group: 'group-data-controller'
|
|
797
753
|
},
|
|
798
754
|
{
|
|
799
755
|
uid: 'rule-execute',
|
|
800
756
|
path: '/SASjsApi/stp/execute',
|
|
801
757
|
type: 'Route',
|
|
802
758
|
setting: 'Grant',
|
|
803
|
-
group:
|
|
804
|
-
uid: 'group-data-controller',
|
|
805
|
-
name: 'DCGroup',
|
|
806
|
-
description: 'Data Controller users',
|
|
807
|
-
isActive: true,
|
|
808
|
-
users: [
|
|
809
|
-
{
|
|
810
|
-
uid: RESTRICTED_UID,
|
|
811
|
-
username: 'user2',
|
|
812
|
-
displayName: 'Demo User',
|
|
813
|
-
isAdmin: false
|
|
814
|
-
}
|
|
815
|
-
]
|
|
816
|
-
}
|
|
759
|
+
group: 'group-data-controller'
|
|
817
760
|
},
|
|
818
761
|
{
|
|
819
762
|
uid: 'rule-code',
|
|
820
763
|
path: '/SASjsApi/code/execute',
|
|
821
764
|
type: 'Route',
|
|
822
765
|
setting: 'Deny',
|
|
823
|
-
user:
|
|
824
|
-
uid: RESTRICTED_UID,
|
|
825
|
-
username: 'user2',
|
|
826
|
-
displayName: 'Demo User',
|
|
827
|
-
isAdmin: false
|
|
828
|
-
}
|
|
766
|
+
user: RESTRICTED_UID
|
|
829
767
|
}
|
|
830
768
|
]
|
|
831
769
|
}
|
|
@@ -846,7 +784,7 @@ exports.RECORD_CORPUS = [
|
|
|
846
784
|
request: {
|
|
847
785
|
token: ADMIN,
|
|
848
786
|
body: {
|
|
849
|
-
path: '/SASjsApi/
|
|
787
|
+
path: '/SASjsApi/drive/folder',
|
|
850
788
|
type: 'Route',
|
|
851
789
|
setting: 'Grant',
|
|
852
790
|
principalType: 'user',
|
|
@@ -855,7 +793,7 @@ exports.RECORD_CORPUS = [
|
|
|
855
793
|
},
|
|
856
794
|
expect: {
|
|
857
795
|
status: 200,
|
|
858
|
-
partial: { path: '/SASjsApi/
|
|
796
|
+
partial: { path: '/SASjsApi/drive/folder', setting: 'Grant' }
|
|
859
797
|
}
|
|
860
798
|
},
|
|
861
799
|
{
|
|
@@ -866,7 +804,7 @@ exports.RECORD_CORPUS = [
|
|
|
866
804
|
request: {
|
|
867
805
|
token: ADMIN,
|
|
868
806
|
body: {
|
|
869
|
-
path: '/SASjsApi/
|
|
807
|
+
path: '/SASjsApi/drive/rename',
|
|
870
808
|
type: 'Route',
|
|
871
809
|
setting: 'Grant',
|
|
872
810
|
principalType: 'group',
|
|
@@ -876,9 +814,9 @@ exports.RECORD_CORPUS = [
|
|
|
876
814
|
expect: {
|
|
877
815
|
status: 200,
|
|
878
816
|
partial: {
|
|
879
|
-
path: '/SASjsApi/
|
|
817
|
+
path: '/SASjsApi/drive/rename',
|
|
880
818
|
setting: 'Grant',
|
|
881
|
-
group:
|
|
819
|
+
group: 'group-data-controller'
|
|
882
820
|
}
|
|
883
821
|
}
|
|
884
822
|
},
|
|
@@ -890,7 +828,7 @@ exports.RECORD_CORPUS = [
|
|
|
890
828
|
request: {
|
|
891
829
|
token: ADMIN,
|
|
892
830
|
body: {
|
|
893
|
-
path: '/SASjsApi/
|
|
831
|
+
path: '/SASjsApi/drive/deploy',
|
|
894
832
|
type: 'Route',
|
|
895
833
|
setting: 'Grant',
|
|
896
834
|
principalType: 'role',
|
|
@@ -910,7 +848,7 @@ exports.RECORD_CORPUS = [
|
|
|
910
848
|
request: {
|
|
911
849
|
token: ADMIN,
|
|
912
850
|
body: {
|
|
913
|
-
path: '/SASjsApi/
|
|
851
|
+
path: '/SASjsApi/drive/folder',
|
|
914
852
|
type: 'Route',
|
|
915
853
|
setting: 'Grant',
|
|
916
854
|
principalType: 'user',
|
|
@@ -930,7 +868,7 @@ exports.RECORD_CORPUS = [
|
|
|
930
868
|
request: {
|
|
931
869
|
token: RESTRICTED,
|
|
932
870
|
body: {
|
|
933
|
-
path: '/SASjsApi/
|
|
871
|
+
path: '/SASjsApi/drive/folder',
|
|
934
872
|
type: 'Route',
|
|
935
873
|
setting: 'Grant',
|
|
936
874
|
principalType: 'user',
|
|
@@ -947,7 +885,7 @@ exports.RECORD_CORPUS = [
|
|
|
947
885
|
request: {
|
|
948
886
|
token: ADMIN,
|
|
949
887
|
body: {
|
|
950
|
-
path: '/SASjsApi/
|
|
888
|
+
path: '/SASjsApi/drive/rename',
|
|
951
889
|
type: 'Route',
|
|
952
890
|
setting: 'Grant',
|
|
953
891
|
principalType: 'group',
|
|
@@ -964,7 +902,7 @@ exports.RECORD_CORPUS = [
|
|
|
964
902
|
request: {
|
|
965
903
|
token: ADMIN,
|
|
966
904
|
body: {
|
|
967
|
-
path: '/SASjsApi/
|
|
905
|
+
path: '/SASjsApi/drive/file',
|
|
968
906
|
type: 'Route',
|
|
969
907
|
setting: 'Grant',
|
|
970
908
|
principalType: 'group',
|
|
@@ -1038,7 +976,7 @@ exports.RECORD_CORPUS = [
|
|
|
1038
976
|
description: 'deletes a rule',
|
|
1039
977
|
identity: exports.ADMIN_SIGNED_IN,
|
|
1040
978
|
request: { token: ADMIN, params: { uid: 'rule-code' } },
|
|
1041
|
-
expect: { status:
|
|
979
|
+
expect: { status: 200, body: 'Permission Deleted!' }
|
|
1042
980
|
},
|
|
1043
981
|
{
|
|
1044
982
|
id: 'delete-permission-not-admin',
|
|
@@ -210,11 +210,15 @@ const dispatch = async (services, routeId, request = {}) => {
|
|
|
210
210
|
body: await required().updateUser(await caller(), { username: String(params.username ?? '') }, body)
|
|
211
211
|
};
|
|
212
212
|
case 'DELETE /SASjsApi/user/{uid}':
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
return {
|
|
214
|
+
status: 200,
|
|
215
|
+
body: await required().deleteUser(await caller(), { uid: String(params.uid ?? '') }, { password: body.password })
|
|
216
|
+
};
|
|
215
217
|
case 'DELETE /SASjsApi/user/by/username/{username}':
|
|
216
|
-
|
|
217
|
-
|
|
218
|
+
return {
|
|
219
|
+
status: 200,
|
|
220
|
+
body: await required().deleteUser(await caller(), { username: String(params.username ?? '') }, { password: body.password })
|
|
221
|
+
};
|
|
218
222
|
case 'GET /SASjsApi/group':
|
|
219
223
|
return { status: 200, body: await required().listGroups(await caller()) };
|
|
220
224
|
case 'GET /SASjsApi/group/{uid}':
|
|
@@ -277,8 +281,10 @@ const dispatch = async (services, routeId, request = {}) => {
|
|
|
277
281
|
body: await required().updatePermission(await caller(), String(params.uid ?? ''), { setting: String(body.setting ?? '') })
|
|
278
282
|
};
|
|
279
283
|
case 'DELETE /SASjsApi/permission/{uid}':
|
|
280
|
-
|
|
281
|
-
|
|
284
|
+
return {
|
|
285
|
+
status: 200,
|
|
286
|
+
body: await required().deletePermission(await caller(), String(params.uid ?? ''))
|
|
287
|
+
};
|
|
282
288
|
case 'GET /SASjsApi/client':
|
|
283
289
|
return { status: 200, body: await required().listClients(await caller()) };
|
|
284
290
|
case 'POST /SASjsApi/client':
|
|
@@ -113,25 +113,14 @@ const createRecordService = (store) => {
|
|
|
113
113
|
const findBy = async (by) => by.uid !== undefined
|
|
114
114
|
? store.userById(by.uid)
|
|
115
115
|
: store.userByName(by.username ?? '');
|
|
116
|
-
const permissionDetails = async (permission) => {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const user = await store.userById(permission.user);
|
|
125
|
-
if (user)
|
|
126
|
-
response.user = asUser(user);
|
|
127
|
-
}
|
|
128
|
-
if (permission.group) {
|
|
129
|
-
const group = await store.groupById(permission.group);
|
|
130
|
-
if (group)
|
|
131
|
-
response.group = await groupDetails(group);
|
|
132
|
-
}
|
|
133
|
-
return response;
|
|
134
|
-
};
|
|
116
|
+
const permissionDetails = async (permission) => ({
|
|
117
|
+
uid: permission.uid,
|
|
118
|
+
path: permission.path,
|
|
119
|
+
type: permission.type,
|
|
120
|
+
setting: permission.setting,
|
|
121
|
+
...(permission.user ? { user: permission.user } : {}),
|
|
122
|
+
...(permission.group ? { group: permission.group } : {})
|
|
123
|
+
});
|
|
135
124
|
return {
|
|
136
125
|
async listUsers(caller) {
|
|
137
126
|
await requireCaller(store, caller);
|
|
@@ -223,6 +212,9 @@ const createRecordService = (store) => {
|
|
|
223
212
|
throw new types_js_1.ApiError(401, 'Invalid password.');
|
|
224
213
|
}
|
|
225
214
|
await store.deleteUser(current.uid);
|
|
215
|
+
// the server's route sends this string itself; the document carries it as
|
|
216
|
+
// the 200 description, so it is the answer and not an extra
|
|
217
|
+
return 'Account Deleted!';
|
|
226
218
|
},
|
|
227
219
|
async listGroups(caller) {
|
|
228
220
|
await requireCaller(store, caller);
|
|
@@ -360,6 +352,7 @@ const createRecordService = (store) => {
|
|
|
360
352
|
if (!(await store.permissionById(uid)))
|
|
361
353
|
throw new types_js_1.ApiError(404, 'Permission not found.');
|
|
362
354
|
await store.deletePermission(uid);
|
|
355
|
+
return 'Permission Deleted!';
|
|
363
356
|
},
|
|
364
357
|
async listClients(caller) {
|
|
365
358
|
await requireAdmin(store, caller);
|
|
@@ -1198,8 +1198,8 @@ exports.GENERATED_ROUTES = [
|
|
|
1198
1198
|
requestBodies: [],
|
|
1199
1199
|
responses: [
|
|
1200
1200
|
{
|
|
1201
|
-
status:
|
|
1202
|
-
description: '
|
|
1201
|
+
status: 200,
|
|
1202
|
+
description: 'Permission Deleted!'
|
|
1203
1203
|
},
|
|
1204
1204
|
{
|
|
1205
1205
|
status: 401,
|
|
@@ -1542,8 +1542,8 @@ exports.GENERATED_ROUTES = [
|
|
|
1542
1542
|
requestBodies: ['application/json'],
|
|
1543
1543
|
responses: [
|
|
1544
1544
|
{
|
|
1545
|
-
status:
|
|
1546
|
-
description: '
|
|
1545
|
+
status: 200,
|
|
1546
|
+
description: 'Account Deleted!'
|
|
1547
1547
|
},
|
|
1548
1548
|
{
|
|
1549
1549
|
status: 401,
|
|
@@ -1682,8 +1682,8 @@ exports.GENERATED_ROUTES = [
|
|
|
1682
1682
|
requestBodies: ['application/json'],
|
|
1683
1683
|
responses: [
|
|
1684
1684
|
{
|
|
1685
|
-
status:
|
|
1686
|
-
description: '
|
|
1685
|
+
status: 200,
|
|
1686
|
+
description: 'Account Deleted!'
|
|
1687
1687
|
},
|
|
1688
1688
|
{
|
|
1689
1689
|
status: 401,
|
|
@@ -199,13 +199,6 @@ exports.OVERLAY = {
|
|
|
199
199
|
},
|
|
200
200
|
'POST /SASjsApi/permission': { implemented: true },
|
|
201
201
|
'PATCH /SASjsApi/permission/{uid}': { implemented: true },
|
|
202
|
-
// The three deletes answer 204 here and 200 on the wire: the server's route
|
|
203
|
-
// handlers send `res.status(200).send('Account Deleted!')` and
|
|
204
|
-
// `'Permission Deleted!'`, while tsoa emitted 204 for a void handler, so the
|
|
205
|
-
// document understates the status. Correcting it is a decorator in
|
|
206
|
-
// sasjs/server (`@SuccessResponse('200', ...)`), and this package follows the
|
|
207
|
-
// document until that release lands - a local 200 would fail the schema check
|
|
208
|
-
// that keeps this table honest.
|
|
209
202
|
'DELETE /SASjsApi/permission/{uid}': { implemented: true },
|
|
210
203
|
// Session - the caller's own session, then the record behind a triggered one
|
|
211
204
|
'GET /SASjsApi/session': {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../../src/corpus/records.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAA;AAkB/B,qFAAqF;AACrF,eAAO,MAAM,eAAe,EAAE,eAG7B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,eA0C9B,CAAA;AAOD,eAAO,MAAM,aAAa,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../../src/corpus/records.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAA;AAkB/B,qFAAqF;AACrF,eAAO,MAAM,eAAe,EAAE,eAG7B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,eA0C9B,CAAA;AAOD,eAAO,MAAM,aAAa,EAAE,UAAU,EA4kCrC,CAAA"}
|
|
@@ -363,7 +363,7 @@ export const RECORD_CORPUS = [
|
|
|
363
363
|
description: 'deletes an account as an administrator, without a password',
|
|
364
364
|
identity: ADMIN_SIGNED_IN,
|
|
365
365
|
request: { token: ADMIN, params: { uid: RESTRICTED_UID }, body: {} },
|
|
366
|
-
expect: { status:
|
|
366
|
+
expect: { status: 200, body: 'Account Deleted!' }
|
|
367
367
|
},
|
|
368
368
|
{
|
|
369
369
|
id: 'delete-user-not-admin',
|
|
@@ -391,7 +391,7 @@ export const RECORD_CORPUS = [
|
|
|
391
391
|
params: { username: 'user2' },
|
|
392
392
|
body: {}
|
|
393
393
|
},
|
|
394
|
-
expect: { status:
|
|
394
|
+
expect: { status: 200, body: 'Account Deleted!' }
|
|
395
395
|
},
|
|
396
396
|
{
|
|
397
397
|
id: 'delete-user-by-username-wrong-password',
|
|
@@ -401,7 +401,7 @@ export const RECORD_CORPUS = [
|
|
|
401
401
|
request: {
|
|
402
402
|
token: RESTRICTED,
|
|
403
403
|
params: { username: 'user2' },
|
|
404
|
-
body: { password: '
|
|
404
|
+
body: { password: 'wrong123' }
|
|
405
405
|
},
|
|
406
406
|
expect: { status: 401, error: 'Invalid password.' }
|
|
407
407
|
},
|
|
@@ -710,55 +710,24 @@ export const RECORD_CORPUS = [
|
|
|
710
710
|
body: [
|
|
711
711
|
{
|
|
712
712
|
uid: 'rule-routes',
|
|
713
|
-
path: '/SASjsApi/
|
|
713
|
+
path: '/SASjsApi/drive/file',
|
|
714
714
|
type: 'Route',
|
|
715
715
|
setting: 'Grant',
|
|
716
|
-
group:
|
|
717
|
-
uid: 'group-data-controller',
|
|
718
|
-
name: 'DCGroup',
|
|
719
|
-
description: 'Data Controller users',
|
|
720
|
-
isActive: true,
|
|
721
|
-
users: [
|
|
722
|
-
{
|
|
723
|
-
uid: RESTRICTED_UID,
|
|
724
|
-
username: 'user2',
|
|
725
|
-
displayName: 'Demo User',
|
|
726
|
-
isAdmin: false
|
|
727
|
-
}
|
|
728
|
-
]
|
|
729
|
-
}
|
|
716
|
+
group: 'group-data-controller'
|
|
730
717
|
},
|
|
731
718
|
{
|
|
732
719
|
uid: 'rule-execute',
|
|
733
720
|
path: '/SASjsApi/stp/execute',
|
|
734
721
|
type: 'Route',
|
|
735
722
|
setting: 'Grant',
|
|
736
|
-
group:
|
|
737
|
-
uid: 'group-data-controller',
|
|
738
|
-
name: 'DCGroup',
|
|
739
|
-
description: 'Data Controller users',
|
|
740
|
-
isActive: true,
|
|
741
|
-
users: [
|
|
742
|
-
{
|
|
743
|
-
uid: RESTRICTED_UID,
|
|
744
|
-
username: 'user2',
|
|
745
|
-
displayName: 'Demo User',
|
|
746
|
-
isAdmin: false
|
|
747
|
-
}
|
|
748
|
-
]
|
|
749
|
-
}
|
|
723
|
+
group: 'group-data-controller'
|
|
750
724
|
},
|
|
751
725
|
{
|
|
752
726
|
uid: 'rule-code',
|
|
753
727
|
path: '/SASjsApi/code/execute',
|
|
754
728
|
type: 'Route',
|
|
755
729
|
setting: 'Deny',
|
|
756
|
-
user:
|
|
757
|
-
uid: RESTRICTED_UID,
|
|
758
|
-
username: 'user2',
|
|
759
|
-
displayName: 'Demo User',
|
|
760
|
-
isAdmin: false
|
|
761
|
-
}
|
|
730
|
+
user: RESTRICTED_UID
|
|
762
731
|
}
|
|
763
732
|
]
|
|
764
733
|
}
|
|
@@ -774,55 +743,24 @@ export const RECORD_CORPUS = [
|
|
|
774
743
|
body: [
|
|
775
744
|
{
|
|
776
745
|
uid: 'rule-routes',
|
|
777
|
-
path: '/SASjsApi/
|
|
746
|
+
path: '/SASjsApi/drive/file',
|
|
778
747
|
type: 'Route',
|
|
779
748
|
setting: 'Grant',
|
|
780
|
-
group:
|
|
781
|
-
uid: 'group-data-controller',
|
|
782
|
-
name: 'DCGroup',
|
|
783
|
-
description: 'Data Controller users',
|
|
784
|
-
isActive: true,
|
|
785
|
-
users: [
|
|
786
|
-
{
|
|
787
|
-
uid: RESTRICTED_UID,
|
|
788
|
-
username: 'user2',
|
|
789
|
-
displayName: 'Demo User',
|
|
790
|
-
isAdmin: false
|
|
791
|
-
}
|
|
792
|
-
]
|
|
793
|
-
}
|
|
749
|
+
group: 'group-data-controller'
|
|
794
750
|
},
|
|
795
751
|
{
|
|
796
752
|
uid: 'rule-execute',
|
|
797
753
|
path: '/SASjsApi/stp/execute',
|
|
798
754
|
type: 'Route',
|
|
799
755
|
setting: 'Grant',
|
|
800
|
-
group:
|
|
801
|
-
uid: 'group-data-controller',
|
|
802
|
-
name: 'DCGroup',
|
|
803
|
-
description: 'Data Controller users',
|
|
804
|
-
isActive: true,
|
|
805
|
-
users: [
|
|
806
|
-
{
|
|
807
|
-
uid: RESTRICTED_UID,
|
|
808
|
-
username: 'user2',
|
|
809
|
-
displayName: 'Demo User',
|
|
810
|
-
isAdmin: false
|
|
811
|
-
}
|
|
812
|
-
]
|
|
813
|
-
}
|
|
756
|
+
group: 'group-data-controller'
|
|
814
757
|
},
|
|
815
758
|
{
|
|
816
759
|
uid: 'rule-code',
|
|
817
760
|
path: '/SASjsApi/code/execute',
|
|
818
761
|
type: 'Route',
|
|
819
762
|
setting: 'Deny',
|
|
820
|
-
user:
|
|
821
|
-
uid: RESTRICTED_UID,
|
|
822
|
-
username: 'user2',
|
|
823
|
-
displayName: 'Demo User',
|
|
824
|
-
isAdmin: false
|
|
825
|
-
}
|
|
763
|
+
user: RESTRICTED_UID
|
|
826
764
|
}
|
|
827
765
|
]
|
|
828
766
|
}
|
|
@@ -843,7 +781,7 @@ export const RECORD_CORPUS = [
|
|
|
843
781
|
request: {
|
|
844
782
|
token: ADMIN,
|
|
845
783
|
body: {
|
|
846
|
-
path: '/SASjsApi/
|
|
784
|
+
path: '/SASjsApi/drive/folder',
|
|
847
785
|
type: 'Route',
|
|
848
786
|
setting: 'Grant',
|
|
849
787
|
principalType: 'user',
|
|
@@ -852,7 +790,7 @@ export const RECORD_CORPUS = [
|
|
|
852
790
|
},
|
|
853
791
|
expect: {
|
|
854
792
|
status: 200,
|
|
855
|
-
partial: { path: '/SASjsApi/
|
|
793
|
+
partial: { path: '/SASjsApi/drive/folder', setting: 'Grant' }
|
|
856
794
|
}
|
|
857
795
|
},
|
|
858
796
|
{
|
|
@@ -863,7 +801,7 @@ export const RECORD_CORPUS = [
|
|
|
863
801
|
request: {
|
|
864
802
|
token: ADMIN,
|
|
865
803
|
body: {
|
|
866
|
-
path: '/SASjsApi/
|
|
804
|
+
path: '/SASjsApi/drive/rename',
|
|
867
805
|
type: 'Route',
|
|
868
806
|
setting: 'Grant',
|
|
869
807
|
principalType: 'group',
|
|
@@ -873,9 +811,9 @@ export const RECORD_CORPUS = [
|
|
|
873
811
|
expect: {
|
|
874
812
|
status: 200,
|
|
875
813
|
partial: {
|
|
876
|
-
path: '/SASjsApi/
|
|
814
|
+
path: '/SASjsApi/drive/rename',
|
|
877
815
|
setting: 'Grant',
|
|
878
|
-
group:
|
|
816
|
+
group: 'group-data-controller'
|
|
879
817
|
}
|
|
880
818
|
}
|
|
881
819
|
},
|
|
@@ -887,7 +825,7 @@ export const RECORD_CORPUS = [
|
|
|
887
825
|
request: {
|
|
888
826
|
token: ADMIN,
|
|
889
827
|
body: {
|
|
890
|
-
path: '/SASjsApi/
|
|
828
|
+
path: '/SASjsApi/drive/deploy',
|
|
891
829
|
type: 'Route',
|
|
892
830
|
setting: 'Grant',
|
|
893
831
|
principalType: 'role',
|
|
@@ -907,7 +845,7 @@ export const RECORD_CORPUS = [
|
|
|
907
845
|
request: {
|
|
908
846
|
token: ADMIN,
|
|
909
847
|
body: {
|
|
910
|
-
path: '/SASjsApi/
|
|
848
|
+
path: '/SASjsApi/drive/folder',
|
|
911
849
|
type: 'Route',
|
|
912
850
|
setting: 'Grant',
|
|
913
851
|
principalType: 'user',
|
|
@@ -927,7 +865,7 @@ export const RECORD_CORPUS = [
|
|
|
927
865
|
request: {
|
|
928
866
|
token: RESTRICTED,
|
|
929
867
|
body: {
|
|
930
|
-
path: '/SASjsApi/
|
|
868
|
+
path: '/SASjsApi/drive/folder',
|
|
931
869
|
type: 'Route',
|
|
932
870
|
setting: 'Grant',
|
|
933
871
|
principalType: 'user',
|
|
@@ -944,7 +882,7 @@ export const RECORD_CORPUS = [
|
|
|
944
882
|
request: {
|
|
945
883
|
token: ADMIN,
|
|
946
884
|
body: {
|
|
947
|
-
path: '/SASjsApi/
|
|
885
|
+
path: '/SASjsApi/drive/rename',
|
|
948
886
|
type: 'Route',
|
|
949
887
|
setting: 'Grant',
|
|
950
888
|
principalType: 'group',
|
|
@@ -961,7 +899,7 @@ export const RECORD_CORPUS = [
|
|
|
961
899
|
request: {
|
|
962
900
|
token: ADMIN,
|
|
963
901
|
body: {
|
|
964
|
-
path: '/SASjsApi/
|
|
902
|
+
path: '/SASjsApi/drive/file',
|
|
965
903
|
type: 'Route',
|
|
966
904
|
setting: 'Grant',
|
|
967
905
|
principalType: 'group',
|
|
@@ -1035,7 +973,7 @@ export const RECORD_CORPUS = [
|
|
|
1035
973
|
description: 'deletes a rule',
|
|
1036
974
|
identity: ADMIN_SIGNED_IN,
|
|
1037
975
|
request: { token: ADMIN, params: { uid: 'rule-code' } },
|
|
1038
|
-
expect: { status:
|
|
976
|
+
expect: { status: 200, body: 'Permission Deleted!' }
|
|
1039
977
|
},
|
|
1040
978
|
{
|
|
1041
979
|
id: 'delete-permission-not-admin',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../src/host/dispatch.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,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BAAwB,CAAA;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAOnD,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,oFAAoF;IACpF,IAAI,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAA;KAAE,CAAA;IACtD;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,mBAAmB;IACnB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;CAC/B;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,YAAY,CAAA;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAA;IAC1B,yFAAyF;IACzF,OAAO,CAAC,EAAE,aAAa,CAAA;CACxB;AAsCD,eAAO,MAAM,QAAQ,GACnB,UAAU,QAAQ,EAClB,SAAS,MAAM,EACf,UAAS,UAAe,KACvB,OAAO,CAAC,WAAW,CAqWrB,CAAA;AAED,0DAA0D;AAC1D,eAAO,MAAM,cAAc,EAAE,MAAM,EAwClC,CAAA"}
|
|
@@ -207,11 +207,15 @@ export const dispatch = async (services, routeId, request = {}) => {
|
|
|
207
207
|
body: await required().updateUser(await caller(), { username: String(params.username ?? '') }, body)
|
|
208
208
|
};
|
|
209
209
|
case 'DELETE /SASjsApi/user/{uid}':
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
return {
|
|
211
|
+
status: 200,
|
|
212
|
+
body: await required().deleteUser(await caller(), { uid: String(params.uid ?? '') }, { password: body.password })
|
|
213
|
+
};
|
|
212
214
|
case 'DELETE /SASjsApi/user/by/username/{username}':
|
|
213
|
-
|
|
214
|
-
|
|
215
|
+
return {
|
|
216
|
+
status: 200,
|
|
217
|
+
body: await required().deleteUser(await caller(), { username: String(params.username ?? '') }, { password: body.password })
|
|
218
|
+
};
|
|
215
219
|
case 'GET /SASjsApi/group':
|
|
216
220
|
return { status: 200, body: await required().listGroups(await caller()) };
|
|
217
221
|
case 'GET /SASjsApi/group/{uid}':
|
|
@@ -274,8 +278,10 @@ export const dispatch = async (services, routeId, request = {}) => {
|
|
|
274
278
|
body: await required().updatePermission(await caller(), String(params.uid ?? ''), { setting: String(body.setting ?? '') })
|
|
275
279
|
};
|
|
276
280
|
case 'DELETE /SASjsApi/permission/{uid}':
|
|
277
|
-
|
|
278
|
-
|
|
281
|
+
return {
|
|
282
|
+
status: 200,
|
|
283
|
+
body: await required().deletePermission(await caller(), String(params.uid ?? ''))
|
|
284
|
+
};
|
|
279
285
|
case 'GET /SASjsApi/client':
|
|
280
286
|
return { status: 200, body: await required().listClients(await caller()) };
|
|
281
287
|
case 'POST /SASjsApi/client':
|
|
@@ -25,13 +25,24 @@ export interface GroupDetailsResponse extends GroupResponse {
|
|
|
25
25
|
isActive: boolean;
|
|
26
26
|
users: UserResponse[];
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* A permission rule as the routes report one.
|
|
30
|
+
*
|
|
31
|
+
* The principal is the identifier, not the whole account: a rule is a row in a
|
|
32
|
+
* table, and a host on any database can produce `user` or `group` as a uid
|
|
33
|
+
* without a join or a populate step. A client that wants the name asks for the
|
|
34
|
+
* account it names, which it can do whether the store is Mongo, a browser's
|
|
35
|
+
* IndexedDB or a file.
|
|
36
|
+
*/
|
|
28
37
|
export interface PermissionResponse {
|
|
29
38
|
uid: string;
|
|
30
39
|
path: string;
|
|
31
40
|
type: string;
|
|
32
41
|
setting: string;
|
|
33
|
-
user
|
|
34
|
-
|
|
42
|
+
/** The uid of the account the rule is assigned to, when it is a user's. */
|
|
43
|
+
user?: string;
|
|
44
|
+
/** The uid of the group the rule is assigned to, when it is a group's. */
|
|
45
|
+
group?: string;
|
|
35
46
|
}
|
|
36
47
|
export interface RecordService {
|
|
37
48
|
listUsers(caller: Subject | undefined): Promise<UserResponse[]>;
|
|
@@ -63,7 +74,7 @@ export interface RecordService {
|
|
|
63
74
|
username?: string;
|
|
64
75
|
}, body: {
|
|
65
76
|
password?: string;
|
|
66
|
-
}): Promise<
|
|
77
|
+
}): Promise<string>;
|
|
67
78
|
listGroups(caller: Subject | undefined): Promise<GroupResponse[]>;
|
|
68
79
|
getGroup(caller: Subject | undefined, by: {
|
|
69
80
|
uid?: string;
|
|
@@ -88,7 +99,7 @@ export interface RecordService {
|
|
|
88
99
|
updatePermission(caller: Subject | undefined, uid: string, body: {
|
|
89
100
|
setting: string;
|
|
90
101
|
}): Promise<PermissionResponse>;
|
|
91
|
-
deletePermission(caller: Subject | undefined, uid: string): Promise<
|
|
102
|
+
deletePermission(caller: Subject | undefined, uid: string): Promise<string>;
|
|
92
103
|
listClients(caller: Subject | undefined): Promise<IdentityClientRecord[]>;
|
|
93
104
|
createClient(caller: Subject | undefined, body: IdentityClientRecord): Promise<IdentityClientRecord>;
|
|
94
105
|
/** `PATCH /SASjsApi/auth/updatePassword`, the caller's own password. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../../src/identity/records.ts"],"names":[],"mappings":"AAgBA,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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QAAE,eAAe,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GACrD,OAAO,CAAC,IAAI,CAAC,CAAA;CACjB;AAiED,eAAO,MAAM,mBAAmB,GAAI,OAAO,OAAO,KAAG,MAKf,CAAA;AAetC,eAAO,MAAM,mBAAmB,GAAI,OAAO,aAAa,KAAG,aAwZ1D,CAAA"}
|
|
@@ -109,25 +109,14 @@ export const createRecordService = (store) => {
|
|
|
109
109
|
const findBy = async (by) => by.uid !== undefined
|
|
110
110
|
? store.userById(by.uid)
|
|
111
111
|
: store.userByName(by.username ?? '');
|
|
112
|
-
const permissionDetails = async (permission) => {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const user = await store.userById(permission.user);
|
|
121
|
-
if (user)
|
|
122
|
-
response.user = asUser(user);
|
|
123
|
-
}
|
|
124
|
-
if (permission.group) {
|
|
125
|
-
const group = await store.groupById(permission.group);
|
|
126
|
-
if (group)
|
|
127
|
-
response.group = await groupDetails(group);
|
|
128
|
-
}
|
|
129
|
-
return response;
|
|
130
|
-
};
|
|
112
|
+
const permissionDetails = async (permission) => ({
|
|
113
|
+
uid: permission.uid,
|
|
114
|
+
path: permission.path,
|
|
115
|
+
type: permission.type,
|
|
116
|
+
setting: permission.setting,
|
|
117
|
+
...(permission.user ? { user: permission.user } : {}),
|
|
118
|
+
...(permission.group ? { group: permission.group } : {})
|
|
119
|
+
});
|
|
131
120
|
return {
|
|
132
121
|
async listUsers(caller) {
|
|
133
122
|
await requireCaller(store, caller);
|
|
@@ -219,6 +208,9 @@ export const createRecordService = (store) => {
|
|
|
219
208
|
throw new ApiError(401, 'Invalid password.');
|
|
220
209
|
}
|
|
221
210
|
await store.deleteUser(current.uid);
|
|
211
|
+
// the server's route sends this string itself; the document carries it as
|
|
212
|
+
// the 200 description, so it is the answer and not an extra
|
|
213
|
+
return 'Account Deleted!';
|
|
222
214
|
},
|
|
223
215
|
async listGroups(caller) {
|
|
224
216
|
await requireCaller(store, caller);
|
|
@@ -356,6 +348,7 @@ export const createRecordService = (store) => {
|
|
|
356
348
|
if (!(await store.permissionById(uid)))
|
|
357
349
|
throw new ApiError(404, 'Permission not found.');
|
|
358
350
|
await store.deletePermission(uid);
|
|
351
|
+
return 'Permission Deleted!';
|
|
359
352
|
},
|
|
360
353
|
async listClients(caller) {
|
|
361
354
|
await requireAdmin(store, caller);
|
|
@@ -1195,8 +1195,8 @@ export const GENERATED_ROUTES = [
|
|
|
1195
1195
|
requestBodies: [],
|
|
1196
1196
|
responses: [
|
|
1197
1197
|
{
|
|
1198
|
-
status:
|
|
1199
|
-
description: '
|
|
1198
|
+
status: 200,
|
|
1199
|
+
description: 'Permission Deleted!'
|
|
1200
1200
|
},
|
|
1201
1201
|
{
|
|
1202
1202
|
status: 401,
|
|
@@ -1539,8 +1539,8 @@ export const GENERATED_ROUTES = [
|
|
|
1539
1539
|
requestBodies: ['application/json'],
|
|
1540
1540
|
responses: [
|
|
1541
1541
|
{
|
|
1542
|
-
status:
|
|
1543
|
-
description: '
|
|
1542
|
+
status: 200,
|
|
1543
|
+
description: 'Account Deleted!'
|
|
1544
1544
|
},
|
|
1545
1545
|
{
|
|
1546
1546
|
status: 401,
|
|
@@ -1679,8 +1679,8 @@ export const GENERATED_ROUTES = [
|
|
|
1679
1679
|
requestBodies: ['application/json'],
|
|
1680
1680
|
responses: [
|
|
1681
1681
|
{
|
|
1682
|
-
status:
|
|
1683
|
-
description: '
|
|
1682
|
+
status: 200,
|
|
1683
|
+
description: 'Account Deleted!'
|
|
1684
1684
|
},
|
|
1685
1685
|
{
|
|
1686
1686
|
status: 401,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../../src/routes/overlay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,KA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kF;AAClF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,CAczD,CAAA;AAiDD,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAuNhD,CAAA;AAED,wEAAwE;AACxE,eAAO,MAAM,OAAO,EAAE,UAAU,EAA8C,CAAA"}
|
|
@@ -196,13 +196,6 @@ export const OVERLAY = {
|
|
|
196
196
|
},
|
|
197
197
|
'POST /SASjsApi/permission': { implemented: true },
|
|
198
198
|
'PATCH /SASjsApi/permission/{uid}': { implemented: true },
|
|
199
|
-
// The three deletes answer 204 here and 200 on the wire: the server's route
|
|
200
|
-
// handlers send `res.status(200).send('Account Deleted!')` and
|
|
201
|
-
// `'Permission Deleted!'`, while tsoa emitted 204 for a void handler, so the
|
|
202
|
-
// document understates the status. Correcting it is a decorator in
|
|
203
|
-
// sasjs/server (`@SuccessResponse('200', ...)`), and this package follows the
|
|
204
|
-
// document until that release lands - a local 200 would fail the schema check
|
|
205
|
-
// that keeps this table honest.
|
|
206
199
|
'DELETE /SASjsApi/permission/{uid}': { implemented: true },
|
|
207
200
|
// Session - the caller's own session, then the record behind a triggered one
|
|
208
201
|
'GET /SASjsApi/session': {
|
package/package.json
CHANGED