@sasjs/api 0.43.0 → 0.44.1

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 CHANGED
@@ -1,4 +1,4 @@
1
- /* @sasjs/api 0.43.0 - the SASjs Server API, for a service worker. https://github.com/sasjs/api */
1
+ /* @sasjs/api 0.44.1 - 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;
@@ -1687,6 +1687,10 @@ var SASjsApi = (() => {
1687
1687
  status: 400,
1688
1688
  description: "Invalid Format"
1689
1689
  },
1690
+ {
1691
+ status: 401,
1692
+ description: "Unauthorized"
1693
+ },
1690
1694
  {
1691
1695
  status: 404,
1692
1696
  description: "No app is published with that id"
@@ -1753,6 +1757,10 @@ var SASjsApi = (() => {
1753
1757
  status: 400,
1754
1758
  description: "Invalid Format"
1755
1759
  },
1760
+ {
1761
+ status: 401,
1762
+ description: "Unauthorized"
1763
+ },
1756
1764
  {
1757
1765
  status: 413,
1758
1766
  description: "File tree exceeds the deploy limit"
@@ -1823,6 +1831,10 @@ var SASjsApi = (() => {
1823
1831
  status: 400,
1824
1832
  description: "Invalid Format"
1825
1833
  },
1834
+ {
1835
+ status: 401,
1836
+ description: "Unauthorized"
1837
+ },
1826
1838
  {
1827
1839
  status: 413,
1828
1840
  description: "File tree exceeds the deploy limit"
@@ -1857,6 +1869,10 @@ var SASjsApi = (() => {
1857
1869
  status: 400,
1858
1870
  description: "Can't delete file outside drive"
1859
1871
  },
1872
+ {
1873
+ status: 401,
1874
+ description: "Unauthorized"
1875
+ },
1860
1876
  {
1861
1877
  status: 404,
1862
1878
  description: "File doesn't exist"
@@ -1897,6 +1913,10 @@ var SASjsApi = (() => {
1897
1913
  status: 400,
1898
1914
  description: "A path outside the drive, a refused extension, or a request naming neither or both"
1899
1915
  },
1916
+ {
1917
+ status: 401,
1918
+ description: "Unauthorized"
1919
+ },
1900
1920
  {
1901
1921
  status: 404,
1902
1922
  description: "File doesn't exist"
@@ -1939,6 +1959,10 @@ var SASjsApi = (() => {
1939
1959
  status: 400,
1940
1960
  description: "Can't modify file outside drive"
1941
1961
  },
1962
+ {
1963
+ status: 401,
1964
+ description: "Unauthorized"
1965
+ },
1942
1966
  {
1943
1967
  status: 404,
1944
1968
  description: "File doesn't exist"
@@ -1981,6 +2005,10 @@ var SASjsApi = (() => {
1981
2005
  status: 400,
1982
2006
  description: "Can't put file outside drive"
1983
2007
  },
2008
+ {
2009
+ status: 401,
2010
+ description: "Unauthorized"
2011
+ },
1984
2012
  {
1985
2013
  status: 409,
1986
2014
  description: "File already exists"
@@ -2006,6 +2034,10 @@ var SASjsApi = (() => {
2006
2034
  {
2007
2035
  status: 200,
2008
2036
  description: "Ok"
2037
+ },
2038
+ {
2039
+ status: 401,
2040
+ description: "Unauthorized"
2009
2041
  }
2010
2042
  ]
2011
2043
  },
@@ -2033,6 +2065,10 @@ var SASjsApi = (() => {
2033
2065
  status: 400,
2034
2066
  description: "Can't delete folder outside drive"
2035
2067
  },
2068
+ {
2069
+ status: 401,
2070
+ description: "Unauthorized"
2071
+ },
2036
2072
  {
2037
2073
  status: 404,
2038
2074
  description: "Folder doesn't exist"
@@ -2063,6 +2099,10 @@ var SASjsApi = (() => {
2063
2099
  status: 400,
2064
2100
  description: "Can't get folder outside drive"
2065
2101
  },
2102
+ {
2103
+ status: 401,
2104
+ description: "Unauthorized"
2105
+ },
2066
2106
  {
2067
2107
  status: 404,
2068
2108
  description: "Folder doesn't exist"
@@ -2093,6 +2133,10 @@ var SASjsApi = (() => {
2093
2133
  status: 400,
2094
2134
  description: "Can't put folder outside drive"
2095
2135
  },
2136
+ {
2137
+ status: 401,
2138
+ description: "Unauthorized"
2139
+ },
2096
2140
  {
2097
2141
  status: 409,
2098
2142
  description: "Folder already exists. The body is that message as plain text."
@@ -2129,6 +2173,10 @@ var SASjsApi = (() => {
2129
2173
  status: 400,
2130
2174
  description: "Can't rename outside drive"
2131
2175
  },
2176
+ {
2177
+ status: 401,
2178
+ description: "Unauthorized"
2179
+ },
2132
2180
  {
2133
2181
  status: 404,
2134
2182
  description: "No file/folder found for provided path"
@@ -3536,9 +3584,8 @@ var SASjsApi = (() => {
3536
3584
  // sasjs/cli#1550, not this package's.
3537
3585
  "GET /SASjsApi/app/{id}": {
3538
3586
  implemented: true,
3539
- // the caller's token is the host's middleware, and a failure that is not the
3540
- // index refusing the id - a drive read that broke - is the host's to answer
3541
- hostResponses: [401, 500],
3587
+ // a drive read that broke is the host's to answer
3588
+ hostResponses: [500],
3542
3589
  // the shape a client reads: the entry as registered, the file it is served from,
3543
3590
  // and whether that file is there
3544
3591
  responses: {
@@ -6661,6 +6708,40 @@ var SASjsApi = (() => {
6661
6708
  };
6662
6709
  };
6663
6710
 
6711
+ // src/identity/routeAccess.ts
6712
+ var TOP_LEVEL_ROUTES = ["/AppStream", "/SASjsApi"];
6713
+ var ALWAYS_VISIBLE_ROUTES = ["/AppStream"];
6714
+ var STATIC_AUTHORIZED_ROUTES = [
6715
+ "/SASjsApi/code/execute",
6716
+ "/SASjsApi/stp/execute",
6717
+ "/SASjsApi/drive/deploy",
6718
+ "/SASjsApi/drive/deploy/upload",
6719
+ "/SASjsApi/drive/file",
6720
+ "/SASjsApi/drive/folder",
6721
+ "/SASjsApi/drive/fileTree",
6722
+ "/SASjsApi/drive/rename"
6723
+ ];
6724
+ var DEFAULT_GRANTABLE_ROUTES = [
6725
+ ...TOP_LEVEL_ROUTES,
6726
+ ...STATIC_AUTHORIZED_ROUTES
6727
+ ];
6728
+ var topLevelRouteFor = (routePath) => TOP_LEVEL_ROUTES.find(
6729
+ (route) => routePath.toLowerCase().startsWith(route.toLowerCase())
6730
+ ) ?? routePath;
6731
+ var settingOn = (rules, path) => rules.find((rule) => rule.path === path)?.setting;
6732
+ var GRANT = "Grant";
6733
+ var DENY = "Deny";
6734
+ var isRouteGranted = (rules, path, topLevelRoute = topLevelRouteFor(path)) => {
6735
+ const userSetting = settingOn(rules.user, path) ?? settingOn(rules.user, topLevelRoute);
6736
+ if (userSetting) return userSetting === GRANT;
6737
+ const onPath = rules.group.filter((rule) => rule.path === path);
6738
+ if (onPath.some((rule) => rule.setting === GRANT)) return true;
6739
+ if (onPath.some((rule) => rule.setting === DENY)) return false;
6740
+ return rules.group.some(
6741
+ (rule) => rule.path === topLevelRoute && rule.setting === GRANT
6742
+ );
6743
+ };
6744
+
6664
6745
  // src/host/dispatch.ts
6665
6746
  var SECONDS_IN_A_DAY = 86400;
6666
6747
  var RUN_ROUTES = [
@@ -6670,11 +6751,12 @@ var SASjsApi = (() => {
6670
6751
  "POST /SASjsApi/code/execute",
6671
6752
  "POST /SASjsApi/code/trigger"
6672
6753
  ];
6673
- var GRANTED_RUN_ROUTES = [
6674
- "GET /SASjsApi/stp/execute",
6675
- "POST /SASjsApi/stp/execute",
6676
- "POST /SASjsApi/code/execute"
6677
- ];
6754
+ var GRANTED_ROUTES = DEFAULT_GRANTABLE_ROUTES.filter(
6755
+ (path) => !TOP_LEVEL_ROUTES.includes(path)
6756
+ );
6757
+ var grantPath = (path) => GRANTED_ROUTES.find(
6758
+ (candidate) => candidate.toLowerCase() === path.toLowerCase()
6759
+ );
6678
6760
  var ADMIN_ROUTES = [
6679
6761
  "GET /SASjsApi/admin/diagnostics",
6680
6762
  "GET /SASjsApi/admin/logs",
@@ -6721,7 +6803,13 @@ var SASjsApi = (() => {
6721
6803
  const identityScoped = ["User", "Group", "Permission", "Client"].includes(route.tag) || routeId === "PATCH /SASjsApi/auth/updatePassword";
6722
6804
  const runtimeScoped = RUN_ROUTES.includes(routeId);
6723
6805
  const adminScoped = ADMIN_ROUTES.includes(routeId) && Boolean(services.admin);
6724
- const grantScoped = Boolean(records) && GRANTED_RUN_ROUTES.includes(routeId);
6806
+ const grantScoped = grantPath(route.path);
6807
+ const appDetailScoped = routeId === "GET /SASjsApi/app/{id}";
6808
+ if ((grantScoped || appDetailScoped) && (identity || request.subject || request.token) && !records)
6809
+ throw new ApiError(
6810
+ 501,
6811
+ `This host has no record service, so it cannot answer ${routeId}.`
6812
+ );
6725
6813
  if (adminScoped && !records)
6726
6814
  throw new ApiError(
6727
6815
  501,
@@ -6736,22 +6824,38 @@ var SASjsApi = (() => {
6736
6824
  }
6737
6825
  return subject;
6738
6826
  };
6739
- if (identityScoped && records || runtimeScoped && services.runtime || adminScoped || grantScoped) {
6827
+ if (appDetailScoped && (identity || records || request.subject || request.token) && !await caller()) {
6828
+ if (!identity)
6829
+ throw new ApiError(
6830
+ 501,
6831
+ `This host has no identity service, so it cannot answer ${routeId}.`
6832
+ );
6833
+ throw new ApiError(401, "Unauthorized");
6834
+ }
6835
+ if (appDetailScoped && records && !await records.mayAct(await caller()))
6836
+ throw new ApiError(401, "Unauthorized");
6837
+ if (identityScoped && records || runtimeScoped && services.runtime || adminScoped || grantScoped && records) {
6740
6838
  const callerSubject = await caller();
6839
+ let publicGrant = false;
6741
6840
  if (!callerSubject) {
6742
- if (!identity)
6743
- throw new ApiError(
6744
- 501,
6745
- `This host has no identity service, so it cannot answer ${routeId}.`
6746
- );
6747
- throw new ApiError(401, "Unauthorized");
6841
+ publicGrant = Boolean(
6842
+ grantScoped && records && !identityScoped && !runtimeScoped && !adminScoped && await records.mayUseRoute(void 0, grantScoped)
6843
+ );
6844
+ if (!publicGrant) {
6845
+ if (!identity)
6846
+ throw new ApiError(
6847
+ 501,
6848
+ `This host has no identity service, so it cannot answer ${routeId}.`
6849
+ );
6850
+ throw new ApiError(401, "Unauthorized");
6851
+ }
6748
6852
  }
6749
6853
  if (adminScoped && !await records.mayAdminister(callerSubject)) {
6750
6854
  if (!await records.mayAct(callerSubject))
6751
6855
  throw new ApiError(401, "Unauthorized");
6752
6856
  throw new ApiError(401, "Admin account required");
6753
6857
  }
6754
- if (grantScoped && !await records.mayUseRoute(callerSubject, route.path))
6858
+ if (grantScoped && records && !publicGrant && !await records.mayUseRoute(callerSubject, grantScoped))
6755
6859
  throw new ApiError(401, "Unauthorized");
6756
6860
  }
6757
6861
  validate(route, request);
@@ -7064,6 +7168,22 @@ var SASjsApi = (() => {
7064
7168
  if (isApiError(err) && err.status === 404) throw appNotRegistered();
7065
7169
  throw err;
7066
7170
  });
7171
+ if (records) {
7172
+ const subject2 = await caller();
7173
+ if (!await records.mayAdminister(subject2)) {
7174
+ const rules = (await records.listPermissions(subject2)).filter(
7175
+ (rule) => rule.type === "Route"
7176
+ );
7177
+ const paths = [`/AppStream/${entry.id}`, `/AppStream/${entry.name}`];
7178
+ const decided = paths.find((path) => rules.some((rule) => rule.path === path)) ?? paths[0];
7179
+ const routeRules = {
7180
+ user: rules.filter((rule) => rule.user === subject2.userId),
7181
+ group: rules.filter((rule) => rule.group !== void 0)
7182
+ };
7183
+ if (!isRouteGranted(routeRules, decided, "/AppStream"))
7184
+ throw appNotRegistered();
7185
+ }
7186
+ }
7067
7187
  const folder = appRootOf(entry);
7068
7188
  let entryFileExists = false;
7069
7189
  let lastModified = null;
@@ -7471,40 +7591,6 @@ var SASjsApi = (() => {
7471
7591
  "PATCH /SASjsApi/auth/updatePassword"
7472
7592
  ];
7473
7593
 
7474
- // src/identity/routeAccess.ts
7475
- var TOP_LEVEL_ROUTES = ["/AppStream", "/SASjsApi"];
7476
- var ALWAYS_VISIBLE_ROUTES = ["/AppStream"];
7477
- var STATIC_AUTHORIZED_ROUTES = [
7478
- "/SASjsApi/code/execute",
7479
- "/SASjsApi/stp/execute",
7480
- "/SASjsApi/drive/deploy",
7481
- "/SASjsApi/drive/deploy/upload",
7482
- "/SASjsApi/drive/file",
7483
- "/SASjsApi/drive/folder",
7484
- "/SASjsApi/drive/fileTree",
7485
- "/SASjsApi/drive/rename"
7486
- ];
7487
- var DEFAULT_GRANTABLE_ROUTES = [
7488
- ...TOP_LEVEL_ROUTES,
7489
- ...STATIC_AUTHORIZED_ROUTES
7490
- ];
7491
- var topLevelRouteFor = (routePath) => TOP_LEVEL_ROUTES.find(
7492
- (route) => routePath.toLowerCase().startsWith(route.toLowerCase())
7493
- ) ?? routePath;
7494
- var settingOn = (rules, path) => rules.find((rule) => rule.path === path)?.setting;
7495
- var GRANT = "Grant";
7496
- var DENY = "Deny";
7497
- var isRouteGranted = (rules, path, topLevelRoute = topLevelRouteFor(path)) => {
7498
- const userSetting = settingOn(rules.user, path) ?? settingOn(rules.user, topLevelRoute);
7499
- if (userSetting) return userSetting === GRANT;
7500
- const onPath = rules.group.filter((rule) => rule.path === path);
7501
- if (onPath.some((rule) => rule.setting === GRANT)) return true;
7502
- if (onPath.some((rule) => rule.setting === DENY)) return false;
7503
- return rules.group.some(
7504
- (rule) => rule.path === topLevelRoute && rule.setting === GRANT
7505
- );
7506
- };
7507
-
7508
7594
  // src/identity/service.ts
7509
7595
  var unauthorized = () => new ApiError(401, "Unauthorized");
7510
7596
  var liveSubject = async (store, subject) => {
@@ -7854,6 +7940,18 @@ var SASjsApi = (() => {
7854
7940
  return Boolean(await readerOf(store, caller));
7855
7941
  },
7856
7942
  async mayUseRoute(caller, path) {
7943
+ if (!caller) {
7944
+ const rules = await store.permissions();
7945
+ if (!rules.some((rule) => rule.group !== void 0)) return false;
7946
+ const publicGroup = (await store.groups()).find(
7947
+ (group) => group.name === PUBLIC_GROUP
7948
+ );
7949
+ return Boolean(
7950
+ publicGroup && rules.some(
7951
+ (rule) => rule.group === publicGroup.uid && rule.path === path && rule.setting === "Grant"
7952
+ )
7953
+ );
7954
+ }
7857
7955
  const reader = await readerOf(store, caller);
7858
7956
  if (!reader) return false;
7859
7957
  if (reader.isAdmin) return true;
@@ -9264,6 +9362,37 @@ var SASjsApi = (() => {
9264
9362
  };
9265
9363
 
9266
9364
  // src/corpus/drive.ts
9365
+ var ADMIN2 = { userId: "user-admin", clientId: "web_app" };
9366
+ var RESTRICTED2 = { userId: "user-restricted", clientId: "web_app" };
9367
+ var NO_DRIVE_GRANTS = {
9368
+ ...DEFAULT_IDENTITY,
9369
+ permissions: DEFAULT_IDENTITY.permissions.filter(
9370
+ (rule) => rule.uid !== "rule-routes"
9371
+ )
9372
+ };
9373
+ var PUBLIC_FILE = {
9374
+ ...DEFAULT_IDENTITY,
9375
+ groups: [
9376
+ ...DEFAULT_IDENTITY.groups,
9377
+ {
9378
+ uid: "group-public",
9379
+ name: "public",
9380
+ description: "Everyone",
9381
+ isActive: true,
9382
+ users: []
9383
+ }
9384
+ ],
9385
+ permissions: [
9386
+ ...DEFAULT_IDENTITY.permissions,
9387
+ {
9388
+ uid: "rule-public-file",
9389
+ path: "/SASjsApi/drive/file",
9390
+ type: "Route",
9391
+ setting: "Grant",
9392
+ group: "group-public"
9393
+ }
9394
+ ]
9395
+ };
9267
9396
  var success2 = { status: "success" };
9268
9397
  var bytes = (...values) => Uint8Array.from(values);
9269
9398
  var manyMembers = (count) => Array.from({ length: count }, (_, at) => ({
@@ -9277,6 +9406,7 @@ var SASjsApi = (() => {
9277
9406
  route: "POST /SASjsApi/drive/file",
9278
9407
  description: "creates a file the drive did not have",
9279
9408
  request: {
9409
+ subject: ADMIN2,
9280
9410
  query: { _filePath: "/data/users.csv" },
9281
9411
  file: { name: "users.csv", contents: "id,name\n1,Ann\n" }
9282
9412
  },
@@ -9287,6 +9417,7 @@ var SASjsApi = (() => {
9287
9417
  route: "POST /SASjsApi/drive/file",
9288
9418
  description: "takes the destination from the form field when the query has none",
9289
9419
  request: {
9420
+ subject: ADMIN2,
9290
9421
  file: { name: "x.csv", contents: "x" },
9291
9422
  body: { filePath: "/data/from-form.csv" }
9292
9423
  },
@@ -9298,6 +9429,7 @@ var SASjsApi = (() => {
9298
9429
  description: "refuses a create over a file that exists, as 409",
9299
9430
  seed: { "/data/exists.csv": "a" },
9300
9431
  request: {
9432
+ subject: ADMIN2,
9301
9433
  query: { _filePath: "/data/exists.csv" },
9302
9434
  file: { name: "x", contents: "b" }
9303
9435
  },
@@ -9308,6 +9440,7 @@ var SASjsApi = (() => {
9308
9440
  route: "POST /SASjsApi/drive/file",
9309
9441
  description: "refuses a refused extension before touching the drive",
9310
9442
  request: {
9443
+ subject: ADMIN2,
9311
9444
  query: { _filePath: "/data/run.sh" },
9312
9445
  file: { name: "run.sh", contents: "x" }
9313
9446
  },
@@ -9318,6 +9451,7 @@ var SASjsApi = (() => {
9318
9451
  route: "POST /SASjsApi/drive/file",
9319
9452
  description: "refuses a path that climbs out of the drive",
9320
9453
  request: {
9454
+ subject: ADMIN2,
9321
9455
  query: { _filePath: "/../escape.csv" },
9322
9456
  file: { name: "x", contents: "x" }
9323
9457
  },
@@ -9327,14 +9461,20 @@ var SASjsApi = (() => {
9327
9461
  id: "create-file-without-payload",
9328
9462
  route: "POST /SASjsApi/drive/file",
9329
9463
  description: "answers for a missing file with the server wording",
9330
- request: { query: { _filePath: "/data/x.csv" } },
9464
+ request: {
9465
+ subject: ADMIN2,
9466
+ query: { _filePath: "/data/x.csv" }
9467
+ },
9331
9468
  expect: { status: 400, error: '"file" is not present.' }
9332
9469
  },
9333
9470
  {
9334
9471
  id: "create-file-without-destination",
9335
9472
  route: "POST /SASjsApi/drive/file",
9336
9473
  description: "answers for a missing destination with the validation wording",
9337
- request: { file: { name: "x", contents: "x" } },
9474
+ request: {
9475
+ subject: ADMIN2,
9476
+ file: { name: "x", contents: "x" }
9477
+ },
9338
9478
  expect: { status: 400, error: '"_filePath" is required' }
9339
9479
  },
9340
9480
  {
@@ -9343,6 +9483,7 @@ var SASjsApi = (() => {
9343
9483
  description: "replaces the contents of a file that exists",
9344
9484
  seed: { "/data/keep.csv": "old" },
9345
9485
  request: {
9486
+ subject: ADMIN2,
9346
9487
  query: { _filePath: "/data/keep.csv" },
9347
9488
  file: { name: "keep.csv", contents: "new" }
9348
9489
  },
@@ -9353,6 +9494,7 @@ var SASjsApi = (() => {
9353
9494
  route: "PATCH /SASjsApi/drive/file",
9354
9495
  description: "refuses a replace of a file that is not there, as 404",
9355
9496
  request: {
9497
+ subject: ADMIN2,
9356
9498
  query: { _filePath: "/data/missing.csv" },
9357
9499
  file: { name: "x", contents: "x" }
9358
9500
  },
@@ -9363,6 +9505,7 @@ var SASjsApi = (() => {
9363
9505
  route: "PATCH /SASjsApi/drive/file",
9364
9506
  description: "refuses a replace of a path that climbs out of the drive",
9365
9507
  request: {
9508
+ subject: ADMIN2,
9366
9509
  query: { _filePath: "/../escape.csv" },
9367
9510
  file: { name: "x", contents: "x" }
9368
9511
  },
@@ -9373,21 +9516,30 @@ var SASjsApi = (() => {
9373
9516
  route: "GET /SASjsApi/drive/file",
9374
9517
  description: "answers with the file contents",
9375
9518
  seed: { "/data/keep.csv": "a,b\n1,2\n" },
9376
- request: { query: { _filePath: "/data/keep.csv" } },
9519
+ request: {
9520
+ subject: ADMIN2,
9521
+ query: { _filePath: "/data/keep.csv" }
9522
+ },
9377
9523
  expect: { status: 200, contents: "a,b\n1,2\n" }
9378
9524
  },
9379
9525
  {
9380
9526
  id: "read-file-missing",
9381
9527
  route: "GET /SASjsApi/drive/file",
9382
9528
  description: "refuses a read of a file that is not there",
9383
- request: { query: { _filePath: "/data/missing.csv" } },
9529
+ request: {
9530
+ subject: ADMIN2,
9531
+ query: { _filePath: "/data/missing.csv" }
9532
+ },
9384
9533
  expect: { status: 404, error: `File doesn't exist.` }
9385
9534
  },
9386
9535
  {
9387
9536
  id: "read-file-outside-drive",
9388
9537
  route: "GET /SASjsApi/drive/file",
9389
9538
  description: "refuses a read of a path that climbs out of the drive",
9390
- request: { query: { _filePath: "/../escape.csv" } },
9539
+ request: {
9540
+ subject: ADMIN2,
9541
+ query: { _filePath: "/../escape.csv" }
9542
+ },
9391
9543
  expect: { status: 400, error: "Can't get file outside drive." }
9392
9544
  },
9393
9545
  {
@@ -9396,6 +9548,7 @@ var SASjsApi = (() => {
9396
9548
  description: "refuses a request that names the file twice, in two readings",
9397
9549
  seed: { "/data/keep.csv": "a" },
9398
9550
  request: {
9551
+ subject: ADMIN2,
9399
9552
  query: { _filePath: "/data/keep.csv", _FILE: "/data/keep.csv" }
9400
9553
  },
9401
9554
  expect: {
@@ -9408,14 +9561,20 @@ var SASjsApi = (() => {
9408
9561
  route: "GET /SASjsApi/drive/file",
9409
9562
  description: "reads a deployment file by the name a streamed page links to",
9410
9563
  seed: { "/Public/app/services/web/main.js": "console.log(1)" },
9411
- request: { query: { _FILE: "/Public/app/services/web/main.js" } },
9564
+ request: {
9565
+ subject: ADMIN2,
9566
+ query: { _FILE: "/Public/app/services/web/main.js" }
9567
+ },
9412
9568
  expect: { status: 200, contents: "console.log(1)" }
9413
9569
  },
9414
9570
  {
9415
9571
  id: "read-streamed-file-missing",
9416
9572
  route: "GET /SASjsApi/drive/file",
9417
9573
  description: "answers a missing deployment file the way the estate does, not as a 404",
9418
- request: { query: { _FILE: "/Public/app/services/web/gone.js" } },
9574
+ request: {
9575
+ subject: ADMIN2,
9576
+ query: { _FILE: "/Public/app/services/web/gone.js" }
9577
+ },
9419
9578
  expect: { status: 202, contents: DEPLOYMENT_FILE_ERROR }
9420
9579
  },
9421
9580
  {
@@ -9423,21 +9582,30 @@ var SASjsApi = (() => {
9423
9582
  route: "DELETE /SASjsApi/drive/file",
9424
9583
  description: "deletes a file that exists",
9425
9584
  seed: { "/data/keep.csv": "a" },
9426
- request: { query: { _filePath: "/data/keep.csv" } },
9585
+ request: {
9586
+ subject: ADMIN2,
9587
+ query: { _filePath: "/data/keep.csv" }
9588
+ },
9427
9589
  expect: { status: 200, body: success2 }
9428
9590
  },
9429
9591
  {
9430
9592
  id: "delete-file-missing",
9431
9593
  route: "DELETE /SASjsApi/drive/file",
9432
9594
  description: "refuses a delete of a file that is not there",
9433
- request: { query: { _filePath: "/data/missing.csv" } },
9595
+ request: {
9596
+ subject: ADMIN2,
9597
+ query: { _filePath: "/data/missing.csv" }
9598
+ },
9434
9599
  expect: { status: 404, error: `File doesn't exist.` }
9435
9600
  },
9436
9601
  {
9437
9602
  id: "delete-file-outside-drive",
9438
9603
  route: "DELETE /SASjsApi/drive/file",
9439
9604
  description: "refuses a delete of a path that climbs out of the drive",
9440
- request: { query: { _filePath: "/../escape.csv" } },
9605
+ request: {
9606
+ subject: ADMIN2,
9607
+ query: { _filePath: "/../escape.csv" }
9608
+ },
9441
9609
  expect: { status: 400, error: "Can't delete file outside drive." }
9442
9610
  },
9443
9611
  {
@@ -9445,42 +9613,59 @@ var SASjsApi = (() => {
9445
9613
  route: "GET /SASjsApi/drive/folder",
9446
9614
  description: "lists the files and folders of a folder",
9447
9615
  seed: { "/data/a.csv": "a", "/data/reports/b.csv": "b" },
9448
- request: { query: { _folderPath: "/data" } },
9616
+ request: {
9617
+ subject: ADMIN2,
9618
+ query: { _folderPath: "/data" }
9619
+ },
9449
9620
  expect: { status: 200, body: { files: ["a.csv"], folders: ["reports"] } }
9450
9621
  },
9451
9622
  {
9452
9623
  id: "list-folder-missing",
9453
9624
  route: "GET /SASjsApi/drive/folder",
9454
9625
  description: "refuses a listing of a folder that is not there",
9455
- request: { query: { _folderPath: "/nope" } },
9626
+ request: {
9627
+ subject: ADMIN2,
9628
+ query: { _folderPath: "/nope" }
9629
+ },
9456
9630
  expect: { status: 404, error: `Folder doesn't exist.` }
9457
9631
  },
9458
9632
  {
9459
9633
  id: "list-folder-outside-drive",
9460
9634
  route: "GET /SASjsApi/drive/folder",
9461
9635
  description: "refuses a listing of a path that climbs out of the drive",
9462
- request: { query: { _folderPath: "/../escape" } },
9636
+ request: {
9637
+ subject: ADMIN2,
9638
+ query: { _folderPath: "/../escape" }
9639
+ },
9463
9640
  expect: { status: 400, error: "Can't get folder outside drive." }
9464
9641
  },
9465
9642
  {
9466
9643
  id: "delete-folder-without-path",
9467
9644
  route: "DELETE /SASjsApi/drive/folder",
9468
9645
  description: "answers for a missing folder path, because the table marks it required",
9469
- request: {},
9646
+ request: {
9647
+ subject: ADMIN2
9648
+ },
9470
9649
  expect: { status: 400, error: '"_folderPath" is required' }
9471
9650
  },
9472
9651
  {
9473
9652
  id: "create-folder-without-path",
9474
9653
  route: "POST /SASjsApi/drive/folder",
9475
9654
  description: "answers for a missing folder path in the body",
9476
- request: { body: {} },
9655
+ request: {
9656
+ subject: ADMIN2,
9657
+ body: {}
9658
+ },
9477
9659
  expect: { status: 400, error: '"folderPath" is required' }
9478
9660
  },
9479
9661
  {
9480
9662
  id: "create-folder",
9481
9663
  route: "POST /SASjsApi/drive/folder",
9482
9664
  description: "creates a folder",
9483
- request: { body: { folderPath: "/data/reports" } },
9665
+ request: {
9666
+ subject: ADMIN2,
9667
+ body: { folderPath: "/data/reports" }
9668
+ },
9484
9669
  expect: { status: 200, body: success2 }
9485
9670
  },
9486
9671
  {
@@ -9488,7 +9673,10 @@ var SASjsApi = (() => {
9488
9673
  route: "POST /SASjsApi/drive/folder",
9489
9674
  description: "refuses a folder that already exists, as 409",
9490
9675
  seed: { "/data/reports/a.csv": "a" },
9491
- request: { body: { folderPath: "/data/reports" } },
9676
+ request: {
9677
+ subject: ADMIN2,
9678
+ body: { folderPath: "/data/reports" }
9679
+ },
9492
9680
  expect: { status: 409, error: "Folder already exists." }
9493
9681
  },
9494
9682
  {
@@ -9496,14 +9684,20 @@ var SASjsApi = (() => {
9496
9684
  route: "DELETE /SASjsApi/drive/folder",
9497
9685
  description: "deletes a folder with everything under it",
9498
9686
  seed: { "/data/reports/a.csv": "a", "/data/reports/nested/b.csv": "b" },
9499
- request: { query: { _folderPath: "/data/reports" } },
9687
+ request: {
9688
+ subject: ADMIN2,
9689
+ query: { _folderPath: "/data/reports" }
9690
+ },
9500
9691
  expect: { status: 200, body: success2 }
9501
9692
  },
9502
9693
  {
9503
9694
  id: "delete-folder-missing",
9504
9695
  route: "DELETE /SASjsApi/drive/folder",
9505
9696
  description: "refuses a delete of a folder that is not there",
9506
- request: { query: { _folderPath: "/nope" } },
9697
+ request: {
9698
+ subject: ADMIN2,
9699
+ query: { _folderPath: "/nope" }
9700
+ },
9507
9701
  expect: { status: 404, error: `Folder doesn't exist.` }
9508
9702
  },
9509
9703
  {
@@ -9511,7 +9705,10 @@ var SASjsApi = (() => {
9511
9705
  route: "POST /SASjsApi/drive/rename",
9512
9706
  description: "moves a file to a new path",
9513
9707
  seed: { "/data/old.csv": "r" },
9514
- request: { body: { oldPath: "/data/old.csv", newPath: "/data/new.csv" } },
9708
+ request: {
9709
+ subject: ADMIN2,
9710
+ body: { oldPath: "/data/old.csv", newPath: "/data/new.csv" }
9711
+ },
9515
9712
  expect: { status: 200, body: success2 }
9516
9713
  },
9517
9714
  {
@@ -9519,14 +9716,20 @@ var SASjsApi = (() => {
9519
9716
  route: "POST /SASjsApi/drive/rename",
9520
9717
  description: "refuses a move onto something that exists",
9521
9718
  seed: { "/data/a.csv": "a", "/data/b.csv": "b" },
9522
- request: { body: { oldPath: "/data/a.csv", newPath: "/data/b.csv" } },
9719
+ request: {
9720
+ subject: ADMIN2,
9721
+ body: { oldPath: "/data/a.csv", newPath: "/data/b.csv" }
9722
+ },
9523
9723
  expect: { status: 409, error: "File with new name already exists." }
9524
9724
  },
9525
9725
  {
9526
9726
  id: "rename-missing",
9527
9727
  route: "POST /SASjsApi/drive/rename",
9528
9728
  description: "refuses a move of something that is not there",
9529
- request: { body: { oldPath: "/data/nope.csv", newPath: "/data/x.csv" } },
9729
+ request: {
9730
+ subject: ADMIN2,
9731
+ body: { oldPath: "/data/nope.csv", newPath: "/data/x.csv" }
9732
+ },
9530
9733
  expect: { status: 404, error: "No file/folder found for provided path." }
9531
9734
  },
9532
9735
  {
@@ -9535,6 +9738,7 @@ var SASjsApi = (() => {
9535
9738
  description: "refuses a rename that would produce a name the file routes refuse",
9536
9739
  seed: { "/data/report.csv": "a,b" },
9537
9740
  request: {
9741
+ subject: ADMIN2,
9538
9742
  body: { oldPath: "/data/report.csv", newPath: "/data/report.sh" }
9539
9743
  },
9540
9744
  expect: { status: 400, error: "Invalid file extension" }
@@ -9545,6 +9749,7 @@ var SASjsApi = (() => {
9545
9749
  description: "renames a folder whose new name carries a blocked suffix",
9546
9750
  seed: { "/data/reports/a.csv": "a" },
9547
9751
  request: {
9752
+ subject: ADMIN2,
9548
9753
  body: { oldPath: "/data/reports", newPath: "/data/reports.sh" }
9549
9754
  },
9550
9755
  expect: { status: 200, body: { status: "success" } }
@@ -9555,6 +9760,7 @@ var SASjsApi = (() => {
9555
9760
  description: "refuses a folder moved inside itself, which the server loses at the filesystem",
9556
9761
  seed: { "/data/reports/a.csv": "a" },
9557
9762
  request: {
9763
+ subject: ADMIN2,
9558
9764
  body: { oldPath: "/data/reports", newPath: "/data/reports/nested" }
9559
9765
  },
9560
9766
  expect: {
@@ -9567,7 +9773,10 @@ var SASjsApi = (() => {
9567
9773
  route: "GET /SASjsApi/drive/filetree",
9568
9774
  description: "answers with the drive tree",
9569
9775
  seed: { "/data/a.csv": "a" },
9570
- request: { query: { _folderPath: "/data" } },
9776
+ request: {
9777
+ subject: ADMIN2,
9778
+ query: { _folderPath: "/data" }
9779
+ },
9571
9780
  expect: {
9572
9781
  status: 200,
9573
9782
  // Partial, because a file's `created` and `modified` are the host's
@@ -9596,6 +9805,7 @@ var SASjsApi = (() => {
9596
9805
  route: "POST /SASjsApi/drive/deploy",
9597
9806
  description: "writes a whole tree under the appLoc it names",
9598
9807
  request: {
9808
+ subject: ADMIN2,
9599
9809
  body: {
9600
9810
  appLoc: "/Public/apps/demo",
9601
9811
  fileTree: {
@@ -9623,6 +9833,7 @@ var SASjsApi = (() => {
9623
9833
  route: "POST /SASjsApi/drive/deploy",
9624
9834
  description: "refuses a tree over the entry cap, naming the figure and the cap",
9625
9835
  request: {
9836
+ subject: ADMIN2,
9626
9837
  body: {
9627
9838
  appLoc: "/Public/apps/many",
9628
9839
  fileTree: { members: manyMembers(10001) }
@@ -9642,6 +9853,7 @@ var SASjsApi = (() => {
9642
9853
  route: "POST /SASjsApi/drive/deploy",
9643
9854
  description: "refuses a member name that would escape the deployment root",
9644
9855
  request: {
9856
+ subject: ADMIN2,
9645
9857
  body: {
9646
9858
  appLoc: "/Public/apps/hostile",
9647
9859
  fileTree: {
@@ -9662,7 +9874,10 @@ var SASjsApi = (() => {
9662
9874
  id: "deploy-refused-by-shape",
9663
9875
  route: "POST /SASjsApi/drive/deploy",
9664
9876
  description: "refuses a fileTree that is not a tree, in the routes own envelope",
9665
- request: { body: { appLoc: "/Public/apps/bad", fileTree: { members: 1 } } },
9877
+ request: {
9878
+ subject: ADMIN2,
9879
+ body: { appLoc: "/Public/apps/bad", fileTree: { members: 1 } }
9880
+ },
9666
9881
  expect: {
9667
9882
  status: 400,
9668
9883
  body: {
@@ -9678,6 +9893,7 @@ var SASjsApi = (() => {
9678
9893
  description: "answers the routes 500 when the drive refuses the write",
9679
9894
  unwritable: true,
9680
9895
  request: {
9896
+ subject: ADMIN2,
9681
9897
  body: {
9682
9898
  appLoc: "/Public/apps/demo",
9683
9899
  fileTree: {
@@ -9696,6 +9912,7 @@ var SASjsApi = (() => {
9696
9912
  route: "POST /SASjsApi/drive/deploy",
9697
9913
  description: "refuses an appLoc that resolves outside the drive",
9698
9914
  request: {
9915
+ subject: ADMIN2,
9699
9916
  body: { appLoc: "/../outside", fileTree: { members: [] } }
9700
9917
  },
9701
9918
  expect: {
@@ -9709,9 +9926,170 @@ var SASjsApi = (() => {
9709
9926
  route: "GET /SASjsApi/drive/file",
9710
9927
  description: "keeps a byte file as bytes",
9711
9928
  seed: { "/data/pack.zip": bytes(80, 75, 3, 4) },
9712
- request: { query: { _filePath: "/data/pack.zip" } },
9929
+ request: {
9930
+ subject: ADMIN2,
9931
+ query: { _filePath: "/data/pack.zip" }
9932
+ },
9713
9933
  expect: { status: 200, contents: bytes(80, 75, 3, 4) }
9714
- }
9934
+ },
9935
+ // --------------------------------------------------- the rule that decides
9936
+ {
9937
+ id: "read-file-anonymous-public-grant",
9938
+ route: "GET /SASjsApi/drive/file",
9939
+ description: "admits an anonymous caller through an exact public group grant",
9940
+ identity: PUBLIC_FILE,
9941
+ seed: { "/data/public.csv": "public contents" },
9942
+ request: { query: { _filePath: "/data/public.csv" } },
9943
+ expect: { status: 200, contents: "public contents" }
9944
+ },
9945
+ {
9946
+ id: "read-file-public-invalid-token",
9947
+ route: "GET /SASjsApi/drive/file",
9948
+ description: "treats an invalid token as anonymous on an exactly public route",
9949
+ identity: PUBLIC_FILE,
9950
+ seed: { "/data/public.csv": "public contents" },
9951
+ request: {
9952
+ token: "invalid-token",
9953
+ query: { _filePath: "/data/public.csv" }
9954
+ },
9955
+ expect: { status: 200, contents: "public contents" }
9956
+ },
9957
+ {
9958
+ id: "read-file-public-inactive-token",
9959
+ route: "GET /SASjsApi/drive/file",
9960
+ description: "treats a deactivated token as anonymous on an exactly public route",
9961
+ identity: {
9962
+ ...PUBLIC_FILE,
9963
+ users: PUBLIC_FILE.users.map(
9964
+ (user3) => user3.uid === "user-restricted" ? { ...user3, isActive: false } : user3
9965
+ ),
9966
+ tokens: [
9967
+ {
9968
+ username: "sasjsuser",
9969
+ clientId: "web_app",
9970
+ accessToken: "inactive-access",
9971
+ refreshToken: "inactive-refresh"
9972
+ }
9973
+ ]
9974
+ },
9975
+ seed: { "/data/public.csv": "public contents" },
9976
+ request: {
9977
+ token: "inactive-access",
9978
+ query: { _filePath: "/data/public.csv" }
9979
+ },
9980
+ expect: { status: 200, contents: "public contents" }
9981
+ },
9982
+ {
9983
+ id: "create-file-anonymous-public-grant",
9984
+ route: "POST /SASjsApi/drive/file",
9985
+ description: "admits public writes when the exact route is granted",
9986
+ identity: PUBLIC_FILE,
9987
+ request: {
9988
+ query: { _filePath: "/data/new.csv" },
9989
+ file: { name: "new.csv", contents: "new" }
9990
+ },
9991
+ expect: { status: 200, body: success2 },
9992
+ expectDrive: { present: ["/data/new.csv"] }
9993
+ },
9994
+ {
9995
+ id: "read-folder-anonymous-other-public-grant",
9996
+ route: "GET /SASjsApi/drive/folder",
9997
+ description: "refuses an anonymous caller when a different path is public",
9998
+ identity: PUBLIC_FILE,
9999
+ request: { query: { _folderPath: "/data" } },
10000
+ expect: { status: 401, error: "Unauthorized" }
10001
+ },
10002
+ {
10003
+ id: "read-file-anonymous-public-parent-grant",
10004
+ route: "GET /SASjsApi/drive/file",
10005
+ description: "does not inherit public authentication from a parent grant",
10006
+ identity: {
10007
+ ...PUBLIC_FILE,
10008
+ permissions: PUBLIC_FILE.permissions.map(
10009
+ (rule) => rule.uid === "rule-public-file" ? { ...rule, path: "/SASjsApi" } : rule
10010
+ )
10011
+ },
10012
+ seed: { "/data/public.csv": "public contents" },
10013
+ request: { query: { _filePath: "/data/public.csv" } },
10014
+ expect: { status: 401, error: "Unauthorized" }
10015
+ },
10016
+ {
10017
+ id: "read-file-anonymous-public-deny",
10018
+ route: "GET /SASjsApi/drive/file",
10019
+ description: "does not authenticate an anonymous caller through a public deny",
10020
+ identity: {
10021
+ ...PUBLIC_FILE,
10022
+ permissions: PUBLIC_FILE.permissions.map(
10023
+ (rule) => rule.uid === "rule-public-file" ? { ...rule, setting: "Deny" } : rule
10024
+ )
10025
+ },
10026
+ request: { query: { _filePath: "/data/public.csv" } },
10027
+ expect: { status: 401, error: "Unauthorized" }
10028
+ },
10029
+ {
10030
+ id: "read-file-public-user-deny",
10031
+ route: "GET /SASjsApi/drive/file",
10032
+ description: "admits an authenticated caller despite an explicit user deny on a public route",
10033
+ identity: {
10034
+ ...PUBLIC_FILE,
10035
+ permissions: [
10036
+ ...PUBLIC_FILE.permissions,
10037
+ {
10038
+ uid: "user-file-deny",
10039
+ path: "/SASjsApi/drive/file",
10040
+ type: "Route",
10041
+ setting: "Deny",
10042
+ user: "user-restricted"
10043
+ }
10044
+ ]
10045
+ },
10046
+ seed: { "/data/public.csv": "public contents" },
10047
+ request: { subject: RESTRICTED2, query: { _filePath: "/data/public.csv" } },
10048
+ expect: { status: 200, contents: "public contents" }
10049
+ },
10050
+ {
10051
+ id: "read-file-granted-by-a-group-rule",
10052
+ route: "GET /SASjsApi/drive/file",
10053
+ description: "admits a restricted account the fixture grants this route, so the refusal beside it is the rule",
10054
+ seed: { "/data/keep.csv": "a,b\n1,2\n" },
10055
+ request: { subject: RESTRICTED2, query: { _filePath: "/data/keep.csv" } },
10056
+ expect: { status: 200, contents: "a,b\n1,2\n" }
10057
+ },
10058
+ {
10059
+ id: "rename-file-denied-to-a-restricted-account",
10060
+ route: "POST /SASjsApi/drive/rename",
10061
+ description: "refuses a drive route the rules do not grant, with the 401 a missing token earns",
10062
+ seed: { "/data/old.csv": "r" },
10063
+ request: {
10064
+ subject: RESTRICTED2,
10065
+ body: { oldPath: "/data/old.csv", newPath: "/data/new.csv" }
10066
+ },
10067
+ expect: { status: 401, error: "Unauthorized" }
10068
+ },
10069
+ // The permission gate refuses a caller the rules do not grant, on every route
10070
+ // the inventory addresses. Each of these is the same account and the same
10071
+ // refusal - the gate runs before the payload is read, which is why a bare
10072
+ // request answers 401 rather than the 400 a missing parameter would earn.
10073
+ ...[
10074
+ "GET /SASjsApi/drive/file",
10075
+ "GET /SASjsApi/drive/folder",
10076
+ "GET /SASjsApi/drive/filetree",
10077
+ "POST /SASjsApi/drive/file",
10078
+ "PATCH /SASjsApi/drive/file",
10079
+ "DELETE /SASjsApi/drive/file",
10080
+ "POST /SASjsApi/drive/folder",
10081
+ "DELETE /SASjsApi/drive/folder",
10082
+ "POST /SASjsApi/drive/deploy",
10083
+ "DELETE /SASjsApi/drive/deploy",
10084
+ "POST /SASjsApi/drive/deploy/upload"
10085
+ ].map((route) => ({
10086
+ id: `${route.toLowerCase().replace(/[^a-z0-9]+/g, "-")}-denied-to-a-restricted-account`,
10087
+ route,
10088
+ description: "refuses a drive route the rules do not grant, before it reads the payload",
10089
+ identity: NO_DRIVE_GRANTS,
10090
+ request: { subject: RESTRICTED2 },
10091
+ expect: { status: 401, error: "Unauthorized" }
10092
+ }))
9715
10093
  ];
9716
10094
 
9717
10095
  // src/corpus/identity.ts
@@ -10870,6 +11248,13 @@ var SASjsApi = (() => {
10870
11248
  var FRONTEND_ENTRY_FILE = `/apps/${FRONTEND_APP.name}/index.html`;
10871
11249
  var ENTRY_FILE_PATH = `${CORPUS_APP.appLoc}/services/${CORPUS_APP.streamWebFolder}/index.html`;
10872
11250
  var APP_CORPUS = [
11251
+ {
11252
+ id: "app-detail-anonymous",
11253
+ route: "GET /SASjsApi/app/{id}",
11254
+ description: "refuses an anonymous caller before looking up an app",
11255
+ request: { params: { id: CORPUS_APP.id } },
11256
+ expect: { status: 401, error: "Unauthorized" }
11257
+ },
10873
11258
  {
10874
11259
  id: "app-detail-published",
10875
11260
  route: "GET /SASjsApi/app/{id}",
@@ -10928,6 +11313,16 @@ var SASjsApi = (() => {
10928
11313
  partial: { entryFileExists: false, lastModified: null }
10929
11314
  }
10930
11315
  },
11316
+ {
11317
+ id: "app-detail-denied",
11318
+ route: "GET /SASjsApi/app/{id}",
11319
+ description: "conceals a registered app from a caller without a stream grant",
11320
+ request: {
11321
+ subject: { userId: "user-restricted", clientId: "web_app" },
11322
+ params: { id: CORPUS_APP.id }
11323
+ },
11324
+ expect: { status: 404, error: "No App Stream is registered with that id." }
11325
+ },
10931
11326
  {
10932
11327
  id: "app-detail-unknown-id",
10933
11328
  route: "GET /SASjsApi/app/{id}",
@@ -10941,8 +11336,8 @@ var SASjsApi = (() => {
10941
11336
  ];
10942
11337
 
10943
11338
  // src/corpus/session.ts
10944
- var ADMIN2 = { userId: "user-admin", clientId: "web_app" };
10945
- var RESTRICTED2 = { userId: "user-restricted", clientId: "web_app" };
11339
+ var ADMIN3 = { userId: "user-admin", clientId: "web_app" };
11340
+ var RESTRICTED3 = { userId: "user-restricted", clientId: "web_app" };
10946
11341
  var notFound2 = (id) => `Session with ID '${id}' was not found.`;
10947
11342
  var UNAUTHORIZED = "Unauthorized";
10948
11343
  var SESSION_CORPUS = [
@@ -10951,7 +11346,7 @@ var SASjsApi = (() => {
10951
11346
  id: "session-summary-own",
10952
11347
  route: "GET /SASjsApi/session/{sessionId}",
10953
11348
  description: "answers the owner the summary of their own session",
10954
- request: { subject: ADMIN2, params: { sessionId: "sess-admin" } },
11349
+ request: { subject: ADMIN3, params: { sessionId: "sess-admin" } },
10955
11350
  expect: {
10956
11351
  status: 200,
10957
11352
  body: {
@@ -10968,7 +11363,7 @@ var SASjsApi = (() => {
10968
11363
  id: "session-summary-as-admin",
10969
11364
  route: "GET /SASjsApi/session/{sessionId}",
10970
11365
  description: "answers an administrator another account's session",
10971
- request: { subject: ADMIN2, params: { sessionId: "sess-restricted" } },
11366
+ request: { subject: ADMIN3, params: { sessionId: "sess-restricted" } },
10972
11367
  // both stamps: the document requires them, and this host stamps a session's
10973
11368
  // death time at creation rather than at completion - a running session
10974
11369
  // answers with the moment it is due to be destroyed
@@ -10994,14 +11389,14 @@ var SASjsApi = (() => {
10994
11389
  id: "session-summary-foreign",
10995
11390
  route: "GET /SASjsApi/session/{sessionId}",
10996
11391
  description: "answers 404 for another account's session, not 403",
10997
- request: { subject: RESTRICTED2, params: { sessionId: "sess-admin" } },
11392
+ request: { subject: RESTRICTED3, params: { sessionId: "sess-admin" } },
10998
11393
  expect: { status: 404, error: notFound2("sess-admin") }
10999
11394
  },
11000
11395
  {
11001
11396
  id: "session-summary-unknown",
11002
11397
  route: "GET /SASjsApi/session/{sessionId}",
11003
11398
  description: "answers the same 404 for a session that does not exist",
11004
- request: { subject: ADMIN2, params: { sessionId: "sess-nope" } },
11399
+ request: { subject: ADMIN3, params: { sessionId: "sess-nope" } },
11005
11400
  expect: { status: 404, error: notFound2("sess-nope") }
11006
11401
  },
11007
11402
  // -------------------------------------------------------------------- log
@@ -11009,7 +11404,7 @@ var SASjsApi = (() => {
11009
11404
  id: "session-log-own",
11010
11405
  route: "GET /SASjsApi/session/{sessionId}/log",
11011
11406
  description: "answers the log this session wrote",
11012
- request: { subject: ADMIN2, params: { sessionId: "sess-admin" } },
11407
+ request: { subject: ADMIN3, params: { sessionId: "sess-admin" } },
11013
11408
  expect: {
11014
11409
  status: 200,
11015
11410
  contents: "NOTE: session started\nNOTE: session completed\n"
@@ -11019,7 +11414,7 @@ var SASjsApi = (() => {
11019
11414
  id: "session-log-nothing-written",
11020
11415
  route: "GET /SASjsApi/session/{sessionId}/log",
11021
11416
  description: "answers an empty body for a session that has written nothing",
11022
- request: { subject: ADMIN2, params: { sessionId: "sess-silent" } },
11417
+ request: { subject: ADMIN3, params: { sessionId: "sess-silent" } },
11023
11418
  expect: { status: 200, contents: "" }
11024
11419
  },
11025
11420
  {
@@ -11033,7 +11428,7 @@ var SASjsApi = (() => {
11033
11428
  id: "session-log-foreign",
11034
11429
  route: "GET /SASjsApi/session/{sessionId}/log",
11035
11430
  description: "will not read another account's log",
11036
- request: { subject: RESTRICTED2, params: { sessionId: "sess-admin" } },
11431
+ request: { subject: RESTRICTED3, params: { sessionId: "sess-admin" } },
11037
11432
  expect: { status: 404, error: notFound2("sess-admin") }
11038
11433
  },
11039
11434
  // ----------------------------------------------------------------- output
@@ -11041,7 +11436,7 @@ var SASjsApi = (() => {
11041
11436
  id: "session-output-own",
11042
11437
  route: "GET /SASjsApi/session/{sessionId}/output",
11043
11438
  description: "answers the webout this session produced",
11044
- request: { subject: ADMIN2, params: { sessionId: "sess-admin" } },
11439
+ request: { subject: ADMIN3, params: { sessionId: "sess-admin" } },
11045
11440
  expect: { status: 200, contents: "<html><body>42</body></html>" }
11046
11441
  },
11047
11442
  {
@@ -11055,7 +11450,7 @@ var SASjsApi = (() => {
11055
11450
  id: "session-output-foreign",
11056
11451
  route: "GET /SASjsApi/session/{sessionId}/output",
11057
11452
  description: "will not read another account's webout",
11058
- request: { subject: RESTRICTED2, params: { sessionId: "sess-admin" } },
11453
+ request: { subject: RESTRICTED3, params: { sessionId: "sess-admin" } },
11059
11454
  expect: { status: 404, error: notFound2("sess-admin") }
11060
11455
  },
11061
11456
  // ------------------------------------------------------------------ state
@@ -11063,7 +11458,7 @@ var SASjsApi = (() => {
11063
11458
  id: "session-state-own",
11064
11459
  route: "GET /SASjsApi/session/{sessionId}/state",
11065
11460
  description: "answers the run time's state for this session",
11066
- request: { subject: RESTRICTED2, params: { sessionId: "sess-restricted" } },
11461
+ request: { subject: RESTRICTED3, params: { sessionId: "sess-restricted" } },
11067
11462
  // the state alone: the document's SessionStateResponse permits no other
11068
11463
  // property, and `sasjs/server` answers exactly this object
11069
11464
  expect: { status: 200, body: { state: "running" } }
@@ -11079,14 +11474,14 @@ var SASjsApi = (() => {
11079
11474
  id: "session-state-foreign",
11080
11475
  route: "GET /SASjsApi/session/{sessionId}/state",
11081
11476
  description: "will not report another account's session state",
11082
- request: { subject: RESTRICTED2, params: { sessionId: "sess-admin" } },
11477
+ request: { subject: RESTRICTED3, params: { sessionId: "sess-admin" } },
11083
11478
  expect: { status: 404, error: notFound2("sess-admin") }
11084
11479
  }
11085
11480
  ];
11086
11481
 
11087
11482
  // src/corpus/runtime.ts
11088
- var ADMIN3 = { userId: "user-admin", clientId: "web_app" };
11089
- var RESTRICTED3 = { userId: "user-restricted", clientId: "web_app" };
11483
+ var ADMIN4 = { userId: "user-admin", clientId: "web_app" };
11484
+ var RESTRICTED4 = { userId: "user-restricted", clientId: "web_app" };
11090
11485
  var PROGRAM = "/Public/apps/demo/run.sas";
11091
11486
  var CODE = 'data _null_;\n put "hello";\nrun;';
11092
11487
  var UNAUTHORIZED2 = "Unauthorized";
@@ -11098,7 +11493,7 @@ var SASjsApi = (() => {
11098
11493
  id: "stp-execute-get-answers-output",
11099
11494
  route: "GET /SASjsApi/stp/execute",
11100
11495
  description: "answers the output the program produced",
11101
- request: { subject: ADMIN3, query: { _program: PROGRAM } },
11496
+ request: { subject: ADMIN4, query: { _program: PROGRAM } },
11102
11497
  runOutput: { contents: "hello from the program" },
11103
11498
  expect: { status: 200, contents: "hello from the program" }
11104
11499
  },
@@ -11106,7 +11501,7 @@ var SASjsApi = (() => {
11106
11501
  id: "stp-execute-get-answers-bytes",
11107
11502
  route: "GET /SASjsApi/stp/execute",
11108
11503
  description: "answers an output that is bytes as bytes",
11109
- request: { subject: ADMIN3, query: { _program: PROGRAM } },
11504
+ request: { subject: ADMIN4, query: { _program: PROGRAM } },
11110
11505
  runOutput: { contents: bytes2(1, 2, 3) },
11111
11506
  expect: { status: 200, contents: bytes2(1, 2, 3) }
11112
11507
  },
@@ -11114,14 +11509,14 @@ var SASjsApi = (() => {
11114
11509
  id: "stp-execute-get-missing-program",
11115
11510
  route: "GET /SASjsApi/stp/execute",
11116
11511
  description: "refuses a request that names no program",
11117
- request: { subject: ADMIN3, query: {} },
11512
+ request: { subject: ADMIN4, query: {} },
11118
11513
  expect: { status: 400, error: '"_program" is required' }
11119
11514
  },
11120
11515
  {
11121
11516
  id: "stp-execute-get-failed-run",
11122
11517
  route: "GET /SASjsApi/stp/execute",
11123
11518
  description: "answers 400 when the program could not be run",
11124
- request: { subject: ADMIN3, query: { _program: PROGRAM } },
11519
+ request: { subject: ADMIN4, query: { _program: PROGRAM } },
11125
11520
  failingRun: true,
11126
11521
  expect: { status: 400, error: FAILED }
11127
11522
  },
@@ -11137,7 +11532,7 @@ var SASjsApi = (() => {
11137
11532
  id: "stp-execute-post-body-program",
11138
11533
  route: "POST /SASjsApi/stp/execute",
11139
11534
  description: "runs the program the body names",
11140
- request: { subject: ADMIN3, body: { _program: PROGRAM } },
11535
+ request: { subject: ADMIN4, body: { _program: PROGRAM } },
11141
11536
  runOutput: { contents: "hello from the body" },
11142
11537
  expect: { status: 200, contents: "hello from the body" }
11143
11538
  },
@@ -11145,7 +11540,7 @@ var SASjsApi = (() => {
11145
11540
  id: "stp-execute-post-query-program",
11146
11541
  route: "POST /SASjsApi/stp/execute",
11147
11542
  description: "runs the program the query names, with no body",
11148
- request: { subject: ADMIN3, query: { _program: PROGRAM }, body: {} },
11543
+ request: { subject: ADMIN4, query: { _program: PROGRAM }, body: {} },
11149
11544
  runOutput: { contents: "hello from the query" },
11150
11545
  expect: { status: 200, contents: "hello from the query" }
11151
11546
  },
@@ -11153,14 +11548,14 @@ var SASjsApi = (() => {
11153
11548
  id: "stp-execute-post-no-program",
11154
11549
  route: "POST /SASjsApi/stp/execute",
11155
11550
  description: "refuses a request with no program in the query or the body",
11156
- request: { subject: ADMIN3, body: {} },
11551
+ request: { subject: ADMIN4, body: {} },
11157
11552
  expect: { status: 400, error: '"_program" is required' }
11158
11553
  },
11159
11554
  {
11160
11555
  id: "stp-execute-post-failed-run",
11161
11556
  route: "POST /SASjsApi/stp/execute",
11162
11557
  description: "answers 400 when the program could not be run",
11163
- request: { subject: ADMIN3, body: { _program: PROGRAM } },
11558
+ request: { subject: ADMIN4, body: { _program: PROGRAM } },
11164
11559
  failingRun: true,
11165
11560
  expect: { status: 400, error: FAILED }
11166
11561
  },
@@ -11176,7 +11571,7 @@ var SASjsApi = (() => {
11176
11571
  id: "stp-trigger-answers-session",
11177
11572
  route: "POST /SASjsApi/stp/trigger",
11178
11573
  description: "answers the session a caller polls, and no pid from a mock",
11179
- request: { subject: ADMIN3, query: { _program: PROGRAM } },
11574
+ request: { subject: ADMIN4, query: { _program: PROGRAM } },
11180
11575
  expect: { status: 200, keys: ["sessionId"] }
11181
11576
  },
11182
11577
  {
@@ -11184,7 +11579,7 @@ var SASjsApi = (() => {
11184
11579
  route: "POST /SASjsApi/stp/trigger",
11185
11580
  description: "accepts a retention in minutes, as the query carries it",
11186
11581
  request: {
11187
- subject: ADMIN3,
11582
+ subject: ADMIN4,
11188
11583
  query: { _program: PROGRAM, expiresAfterMins: "15" }
11189
11584
  },
11190
11585
  expect: { status: 200, keys: ["sessionId"] }
@@ -11194,7 +11589,7 @@ var SASjsApi = (() => {
11194
11589
  route: "POST /SASjsApi/stp/trigger",
11195
11590
  description: "refuses a retention that is not a positive number of minutes",
11196
11591
  request: {
11197
- subject: ADMIN3,
11592
+ subject: ADMIN4,
11198
11593
  query: { _program: PROGRAM, expiresAfterMins: "0" }
11199
11594
  },
11200
11595
  expect: { status: 400, error: '"expiresAfterMins" must be greater than 0' }
@@ -11203,14 +11598,14 @@ var SASjsApi = (() => {
11203
11598
  id: "stp-trigger-missing-program",
11204
11599
  route: "POST /SASjsApi/stp/trigger",
11205
11600
  description: "refuses a request that names no program",
11206
- request: { subject: ADMIN3, query: {} },
11601
+ request: { subject: ADMIN4, query: {} },
11207
11602
  expect: { status: 400, error: '"_program" is required' }
11208
11603
  },
11209
11604
  {
11210
11605
  id: "stp-trigger-failed-run",
11211
11606
  route: "POST /SASjsApi/stp/trigger",
11212
11607
  description: "answers 400 when the program could not be started",
11213
- request: { subject: ADMIN3, query: { _program: PROGRAM } },
11608
+ request: { subject: ADMIN4, query: { _program: PROGRAM } },
11214
11609
  failingRun: true,
11215
11610
  expect: { status: 400, error: FAILED }
11216
11611
  },
@@ -11226,7 +11621,7 @@ var SASjsApi = (() => {
11226
11621
  id: "code-execute-answers-output",
11227
11622
  route: "POST /SASjsApi/code/execute",
11228
11623
  description: "runs the code in the body and answers its output",
11229
- request: { subject: ADMIN3, body: { code: CODE, runTime: "sas" } },
11624
+ request: { subject: ADMIN4, body: { code: CODE, runTime: "sas" } },
11230
11625
  runOutput: { contents: "NOTE: mock run" },
11231
11626
  expect: { status: 200, contents: "NOTE: mock run" }
11232
11627
  },
@@ -11240,35 +11635,35 @@ var SASjsApi = (() => {
11240
11635
  id: "code-execute-unknown-runtime",
11241
11636
  route: "POST /SASjsApi/code/execute",
11242
11637
  description: "refuses a run time the document does not name",
11243
- request: { subject: ADMIN3, body: { code: CODE, runTime: "cobol" } },
11638
+ request: { subject: ADMIN4, body: { code: CODE, runTime: "cobol" } },
11244
11639
  expect: { status: 400 }
11245
11640
  },
11246
11641
  {
11247
11642
  id: "code-execute-missing-code",
11248
11643
  route: "POST /SASjsApi/code/execute",
11249
11644
  description: "refuses a payload with no code",
11250
- request: { subject: ADMIN3, body: { runTime: "sas" } },
11645
+ request: { subject: ADMIN4, body: { runTime: "sas" } },
11251
11646
  expect: { status: 400, error: '"code" is required' }
11252
11647
  },
11253
11648
  {
11254
11649
  id: "code-execute-empty-code",
11255
11650
  route: "POST /SASjsApi/code/execute",
11256
11651
  description: "refuses code that is present but empty",
11257
- request: { subject: ADMIN3, body: { code: "", runTime: "sas" } },
11652
+ request: { subject: ADMIN4, body: { code: "", runTime: "sas" } },
11258
11653
  expect: { status: 400, error: '"code" is not allowed to be empty' }
11259
11654
  },
11260
11655
  {
11261
11656
  id: "code-execute-non-string-code",
11262
11657
  route: "POST /SASjsApi/code/execute",
11263
11658
  description: "refuses code that is not a string rather than running its text",
11264
- request: { subject: ADMIN3, body: { code: 123, runTime: "sas" } },
11659
+ request: { subject: ADMIN4, body: { code: 123, runTime: "sas" } },
11265
11660
  expect: { status: 400, error: '"code" must be a string' }
11266
11661
  },
11267
11662
  {
11268
11663
  id: "code-execute-failed-run",
11269
11664
  route: "POST /SASjsApi/code/execute",
11270
11665
  description: "answers 400 when the code could not be run",
11271
- request: { subject: ADMIN3, body: { code: CODE, runTime: "sas" } },
11666
+ request: { subject: ADMIN4, body: { code: CODE, runTime: "sas" } },
11272
11667
  failingRun: true,
11273
11668
  expect: { status: 400, error: FAILED }
11274
11669
  },
@@ -11287,7 +11682,7 @@ var SASjsApi = (() => {
11287
11682
  id: "code-execute-denied-by-a-rule",
11288
11683
  route: "POST /SASjsApi/code/execute",
11289
11684
  description: "refuses a caller the rules do not grant, with the 401 a missing token earns",
11290
- request: { subject: RESTRICTED3, body: { code: CODE, runTime: "sas" } },
11685
+ request: { subject: RESTRICTED4, body: { code: CODE, runTime: "sas" } },
11291
11686
  expect: { status: 401, error: UNAUTHORIZED2 }
11292
11687
  },
11293
11688
  {
@@ -11297,7 +11692,7 @@ var SASjsApi = (() => {
11297
11692
  id: "stp-execute-granted-by-a-group-rule",
11298
11693
  route: "POST /SASjsApi/stp/execute",
11299
11694
  description: "admits a restricted account the rules grant",
11300
- request: { subject: RESTRICTED3, body: { _program: PROGRAM } },
11695
+ request: { subject: RESTRICTED4, body: { _program: PROGRAM } },
11301
11696
  runOutput: { contents: "granted run" },
11302
11697
  expect: { status: 200, contents: "granted run" }
11303
11698
  },
@@ -11306,14 +11701,14 @@ var SASjsApi = (() => {
11306
11701
  id: "code-trigger-answers-session",
11307
11702
  route: "POST /SASjsApi/code/trigger",
11308
11703
  description: "answers the session a caller polls, and no pid from a mock",
11309
- request: { subject: ADMIN3, body: { code: CODE, runTime: "sas" } },
11704
+ request: { subject: ADMIN4, body: { code: CODE, runTime: "sas" } },
11310
11705
  expect: { status: 200, keys: ["sessionId"] }
11311
11706
  },
11312
11707
  {
11313
11708
  id: "code-trigger-missing-runtime",
11314
11709
  route: "POST /SASjsApi/code/trigger",
11315
11710
  description: "refuses a payload with no run time, which the document requires",
11316
- request: { subject: ADMIN3, body: { code: CODE } },
11711
+ request: { subject: ADMIN4, body: { code: CODE } },
11317
11712
  expect: { status: 400, error: '"runTime" is required' }
11318
11713
  },
11319
11714
  {
@@ -11321,7 +11716,7 @@ var SASjsApi = (() => {
11321
11716
  route: "POST /SASjsApi/code/trigger",
11322
11717
  description: "refuses a retention that is not a positive number of minutes",
11323
11718
  request: {
11324
- subject: ADMIN3,
11719
+ subject: ADMIN4,
11325
11720
  body: { code: CODE, runTime: "sas", expiresAfterMins: 0 }
11326
11721
  },
11327
11722
  expect: { status: 400, error: '"expiresAfterMins" must be greater than 0' }
@@ -11330,7 +11725,7 @@ var SASjsApi = (() => {
11330
11725
  id: "code-trigger-failed-run",
11331
11726
  route: "POST /SASjsApi/code/trigger",
11332
11727
  description: "answers 400 when the code could not be started",
11333
- request: { subject: ADMIN3, body: { code: CODE, runTime: "sas" } },
11728
+ request: { subject: ADMIN4, body: { code: CODE, runTime: "sas" } },
11334
11729
  failingRun: true,
11335
11730
  expect: { status: 400, error: FAILED }
11336
11731
  },
@@ -11405,8 +11800,8 @@ var SASjsApi = (() => {
11405
11800
  }
11406
11801
  ]
11407
11802
  };
11408
- var ADMIN4 = "admin-access";
11409
- var RESTRICTED4 = "user-access";
11803
+ var ADMIN5 = "admin-access";
11804
+ var RESTRICTED5 = "user-access";
11410
11805
  var RESTRICTED_UID = "user-restricted";
11411
11806
  var ADMIN_UID = "user-admin";
11412
11807
  var RECORD_CORPUS = [
@@ -11416,7 +11811,7 @@ var SASjsApi = (() => {
11416
11811
  route: "GET /SASjsApi/user",
11417
11812
  description: "lists the accounts any signed-in caller may see",
11418
11813
  identity: ADMIN_SIGNED_IN,
11419
- request: { token: ADMIN4 },
11814
+ request: { token: ADMIN5 },
11420
11815
  expect: {
11421
11816
  status: 200,
11422
11817
  body: [
@@ -11440,7 +11835,7 @@ var SASjsApi = (() => {
11440
11835
  route: "GET /SASjsApi/user/{uid}",
11441
11836
  description: "returns the caller their own details, with the auto-exec code",
11442
11837
  identity: ADMIN_SIGNED_IN,
11443
- request: { token: RESTRICTED4, params: { uid: RESTRICTED_UID } },
11838
+ request: { token: RESTRICTED5, params: { uid: RESTRICTED_UID } },
11444
11839
  expect: {
11445
11840
  status: 200,
11446
11841
  partial: {
@@ -11465,7 +11860,7 @@ var SASjsApi = (() => {
11465
11860
  route: "GET /SASjsApi/user/{uid}",
11466
11861
  description: "answers 404 for an identifier no account has",
11467
11862
  identity: ADMIN_SIGNED_IN,
11468
- request: { token: ADMIN4, params: { uid: "user-none" } },
11863
+ request: { token: ADMIN5, params: { uid: "user-none" } },
11469
11864
  expect: { status: 404, error: "User is not found." }
11470
11865
  },
11471
11866
  {
@@ -11473,7 +11868,7 @@ var SASjsApi = (() => {
11473
11868
  route: "GET /SASjsApi/user/by/username/{username}",
11474
11869
  description: "finds an account by username",
11475
11870
  identity: ADMIN_SIGNED_IN,
11476
- request: { token: ADMIN4, params: { username: "sasjsuser" } },
11871
+ request: { token: ADMIN5, params: { username: "sasjsuser" } },
11477
11872
  expect: {
11478
11873
  status: 200,
11479
11874
  partial: { uid: RESTRICTED_UID, username: "sasjsuser", isAdmin: false }
@@ -11492,7 +11887,7 @@ var SASjsApi = (() => {
11492
11887
  route: "GET /SASjsApi/user/by/username/{username}",
11493
11888
  description: "answers 404 for a username no account has",
11494
11889
  identity: ADMIN_SIGNED_IN,
11495
- request: { token: ADMIN4, params: { username: "nobody" } },
11890
+ request: { token: ADMIN5, params: { username: "nobody" } },
11496
11891
  expect: { status: 404, error: "User is not found." }
11497
11892
  },
11498
11893
  {
@@ -11501,7 +11896,7 @@ var SASjsApi = (() => {
11501
11896
  description: "creates an account, sanitised, and reports it",
11502
11897
  identity: ADMIN_SIGNED_IN,
11503
11898
  request: {
11504
- token: ADMIN4,
11899
+ token: ADMIN5,
11505
11900
  body: {
11506
11901
  username: "newuser",
11507
11902
  displayName: " New User ",
@@ -11526,7 +11921,7 @@ var SASjsApi = (() => {
11526
11921
  description: "refuses a creation by a caller who is not an administrator",
11527
11922
  identity: ADMIN_SIGNED_IN,
11528
11923
  request: {
11529
- token: RESTRICTED4,
11924
+ token: RESTRICTED5,
11530
11925
  body: {
11531
11926
  username: "newuser",
11532
11927
  displayName: "New User",
@@ -11549,7 +11944,7 @@ var SASjsApi = (() => {
11549
11944
  description: "refuses a username that is taken",
11550
11945
  identity: ADMIN_SIGNED_IN,
11551
11946
  request: {
11552
- token: ADMIN4,
11947
+ token: ADMIN5,
11553
11948
  body: {
11554
11949
  username: "sasjsuser",
11555
11950
  displayName: "Another",
@@ -11564,7 +11959,7 @@ var SASjsApi = (() => {
11564
11959
  description: "changes an account's display name",
11565
11960
  identity: ADMIN_SIGNED_IN,
11566
11961
  request: {
11567
- token: ADMIN4,
11962
+ token: ADMIN5,
11568
11963
  params: { uid: RESTRICTED_UID },
11569
11964
  body: {
11570
11965
  displayName: "Renamed User",
@@ -11583,7 +11978,7 @@ var SASjsApi = (() => {
11583
11978
  description: "refuses a change to somebody else's account",
11584
11979
  identity: ADMIN_SIGNED_IN,
11585
11980
  request: {
11586
- token: RESTRICTED4,
11981
+ token: RESTRICTED5,
11587
11982
  params: { uid: ADMIN_UID },
11588
11983
  body: {
11589
11984
  displayName: "Hijacked",
@@ -11599,7 +11994,7 @@ var SASjsApi = (() => {
11599
11994
  description: "answers 404 with the identifier it looked up",
11600
11995
  identity: ADMIN_SIGNED_IN,
11601
11996
  request: {
11602
- token: ADMIN4,
11997
+ token: ADMIN5,
11603
11998
  params: { uid: "user-none" },
11604
11999
  body: { displayName: "Nobody", username: "nobody", password: "none123" }
11605
12000
  },
@@ -11611,7 +12006,7 @@ var SASjsApi = (() => {
11611
12006
  description: "refuses a username change on a provider-managed account",
11612
12007
  identity: PROVIDER_MANAGED,
11613
12008
  request: {
11614
- token: ADMIN4,
12009
+ token: ADMIN5,
11615
12010
  params: { uid: "user-directory" },
11616
12011
  body: {
11617
12012
  username: "renamed",
@@ -11630,7 +12025,7 @@ var SASjsApi = (() => {
11630
12025
  description: "refuses a username another account already has",
11631
12026
  identity: ADMIN_SIGNED_IN,
11632
12027
  request: {
11633
- token: ADMIN4,
12028
+ token: ADMIN5,
11634
12029
  params: { uid: RESTRICTED_UID },
11635
12030
  body: {
11636
12031
  username: "sasjsadmin",
@@ -11646,7 +12041,7 @@ var SASjsApi = (() => {
11646
12041
  description: "changes an account looked up by username",
11647
12042
  identity: ADMIN_SIGNED_IN,
11648
12043
  request: {
11649
- token: ADMIN4,
12044
+ token: ADMIN5,
11650
12045
  params: { username: "sasjsuser" },
11651
12046
  body: {
11652
12047
  isActive: false,
@@ -11663,7 +12058,7 @@ var SASjsApi = (() => {
11663
12058
  description: "refuses a change to another account by username",
11664
12059
  identity: ADMIN_SIGNED_IN,
11665
12060
  request: {
11666
- token: RESTRICTED4,
12061
+ token: RESTRICTED5,
11667
12062
  params: { username: "sasjsadmin" },
11668
12063
  body: {
11669
12064
  displayName: "Hijacked",
@@ -11679,7 +12074,7 @@ var SASjsApi = (() => {
11679
12074
  description: "answers 404 with the username it looked up",
11680
12075
  identity: ADMIN_SIGNED_IN,
11681
12076
  request: {
11682
- token: ADMIN4,
12077
+ token: ADMIN5,
11683
12078
  params: { username: "nobody" },
11684
12079
  body: { displayName: "Nobody", username: "nobody", password: "none123" }
11685
12080
  },
@@ -11691,7 +12086,7 @@ var SASjsApi = (() => {
11691
12086
  description: "refuses a display-name change on a provider-managed account",
11692
12087
  identity: PROVIDER_MANAGED,
11693
12088
  request: {
11694
- token: ADMIN4,
12089
+ token: ADMIN5,
11695
12090
  params: { username: "diruser" },
11696
12091
  body: { displayName: "Renamed", username: "diruser", password: "dir123" }
11697
12092
  },
@@ -11706,7 +12101,7 @@ var SASjsApi = (() => {
11706
12101
  description: "refuses a username another account already has",
11707
12102
  identity: ADMIN_SIGNED_IN,
11708
12103
  request: {
11709
- token: ADMIN4,
12104
+ token: ADMIN5,
11710
12105
  params: { username: "sasjsuser" },
11711
12106
  body: {
11712
12107
  username: "sasjsadmin",
@@ -11721,7 +12116,7 @@ var SASjsApi = (() => {
11721
12116
  route: "DELETE /SASjsApi/user/{uid}",
11722
12117
  description: "deletes an account as an administrator, without a password",
11723
12118
  identity: ADMIN_SIGNED_IN,
11724
- request: { token: ADMIN4, params: { uid: RESTRICTED_UID }, body: {} },
12119
+ request: { token: ADMIN5, params: { uid: RESTRICTED_UID }, body: {} },
11725
12120
  expect: { status: 200, body: "Account Deleted!" }
11726
12121
  },
11727
12122
  {
@@ -11729,7 +12124,7 @@ var SASjsApi = (() => {
11729
12124
  route: "DELETE /SASjsApi/user/{uid}",
11730
12125
  description: "refuses a deletion of somebody else's account",
11731
12126
  identity: ADMIN_SIGNED_IN,
11732
- request: { token: RESTRICTED4, params: { uid: ADMIN_UID }, body: {} },
12127
+ request: { token: RESTRICTED5, params: { uid: ADMIN_UID }, body: {} },
11733
12128
  expect: { status: 401, error: "Admin account required" }
11734
12129
  },
11735
12130
  {
@@ -11737,7 +12132,7 @@ var SASjsApi = (() => {
11737
12132
  route: "DELETE /SASjsApi/user/{uid}",
11738
12133
  description: "answers 404 for an identifier no account has",
11739
12134
  identity: ADMIN_SIGNED_IN,
11740
- request: { token: ADMIN4, params: { uid: "user-none" }, body: {} },
12135
+ request: { token: ADMIN5, params: { uid: "user-none" }, body: {} },
11741
12136
  expect: { status: 404, error: "User is not found." }
11742
12137
  },
11743
12138
  {
@@ -11746,7 +12141,7 @@ var SASjsApi = (() => {
11746
12141
  description: "deletes an account looked up by username",
11747
12142
  identity: ADMIN_SIGNED_IN,
11748
12143
  request: {
11749
- token: ADMIN4,
12144
+ token: ADMIN5,
11750
12145
  params: { username: "sasjsuser" },
11751
12146
  body: {}
11752
12147
  },
@@ -11758,7 +12153,7 @@ var SASjsApi = (() => {
11758
12153
  description: "refuses a self-deletion whose password is wrong",
11759
12154
  identity: ADMIN_SIGNED_IN,
11760
12155
  request: {
11761
- token: RESTRICTED4,
12156
+ token: RESTRICTED5,
11762
12157
  params: { username: "sasjsuser" },
11763
12158
  body: { password: "wrong123" }
11764
12159
  },
@@ -11769,7 +12164,7 @@ var SASjsApi = (() => {
11769
12164
  route: "DELETE /SASjsApi/user/by/username/{username}",
11770
12165
  description: "answers 404 for a username no account has",
11771
12166
  identity: ADMIN_SIGNED_IN,
11772
- request: { token: ADMIN4, params: { username: "nobody" }, body: {} },
12167
+ request: { token: ADMIN5, params: { username: "nobody" }, body: {} },
11773
12168
  expect: { status: 404, error: "User is not found." }
11774
12169
  },
11775
12170
  // ----------------------------------------------------------------- groups
@@ -11778,7 +12173,7 @@ var SASjsApi = (() => {
11778
12173
  route: "GET /SASjsApi/group",
11779
12174
  description: "lists the groups",
11780
12175
  identity: ADMIN_SIGNED_IN,
11781
- request: { token: RESTRICTED4 },
12176
+ request: { token: RESTRICTED5 },
11782
12177
  expect: {
11783
12178
  status: 200,
11784
12179
  body: [
@@ -11800,7 +12195,7 @@ var SASjsApi = (() => {
11800
12195
  route: "GET /SASjsApi/group/{uid}",
11801
12196
  description: "returns a group and its members",
11802
12197
  identity: ADMIN_SIGNED_IN,
11803
- request: { token: RESTRICTED4, params: { uid: "group-admins" } },
12198
+ request: { token: RESTRICTED5, params: { uid: "group-admins" } },
11804
12199
  expect: {
11805
12200
  status: 200,
11806
12201
  partial: {
@@ -11823,7 +12218,7 @@ var SASjsApi = (() => {
11823
12218
  route: "GET /SASjsApi/group/{uid}",
11824
12219
  description: "answers 404 for an identifier no group has",
11825
12220
  identity: ADMIN_SIGNED_IN,
11826
- request: { token: ADMIN4, params: { uid: "group-none" } },
12221
+ request: { token: ADMIN5, params: { uid: "group-none" } },
11827
12222
  expect: { status: 404, error: "Group not found." }
11828
12223
  },
11829
12224
  {
@@ -11831,7 +12226,7 @@ var SASjsApi = (() => {
11831
12226
  route: "GET /SASjsApi/group/by/groupname/{name}",
11832
12227
  description: "finds a group by name",
11833
12228
  identity: ADMIN_SIGNED_IN,
11834
- request: { token: ADMIN4, params: { name: "DCGroup" } },
12229
+ request: { token: ADMIN5, params: { name: "DCGroup" } },
11835
12230
  expect: {
11836
12231
  status: 200,
11837
12232
  partial: { uid: "group-data-controller", name: "DCGroup" }
@@ -11842,7 +12237,7 @@ var SASjsApi = (() => {
11842
12237
  route: "GET /SASjsApi/group/by/groupname/{name}",
11843
12238
  description: "answers 404 for a name no group has",
11844
12239
  identity: ADMIN_SIGNED_IN,
11845
- request: { token: ADMIN4, params: { name: "nope" } },
12240
+ request: { token: ADMIN5, params: { name: "nope" } },
11846
12241
  expect: { status: 404, error: "Group not found." }
11847
12242
  },
11848
12243
  {
@@ -11851,7 +12246,7 @@ var SASjsApi = (() => {
11851
12246
  description: "creates a group with no members",
11852
12247
  identity: ADMIN_SIGNED_IN,
11853
12248
  request: {
11854
- token: ADMIN4,
12249
+ token: ADMIN5,
11855
12250
  body: { name: "NewGroup", description: "A new group", isActive: true }
11856
12251
  },
11857
12252
  expect: {
@@ -11870,7 +12265,7 @@ var SASjsApi = (() => {
11870
12265
  description: "refuses a creation by a caller who is not an administrator",
11871
12266
  identity: ADMIN_SIGNED_IN,
11872
12267
  request: {
11873
- token: RESTRICTED4,
12268
+ token: RESTRICTED5,
11874
12269
  body: { name: "NewGroup", description: "x" }
11875
12270
  },
11876
12271
  expect: { status: 401, error: "Admin account required" }
@@ -11880,7 +12275,7 @@ var SASjsApi = (() => {
11880
12275
  route: "POST /SASjsApi/group",
11881
12276
  description: "refuses a name that is taken",
11882
12277
  identity: ADMIN_SIGNED_IN,
11883
- request: { token: ADMIN4, body: { name: "DCGroup", description: "again" } },
12278
+ request: { token: ADMIN5, body: { name: "DCGroup", description: "again" } },
11884
12279
  expect: { status: 409, error: "Group name already exists." }
11885
12280
  },
11886
12281
  {
@@ -11889,7 +12284,7 @@ var SASjsApi = (() => {
11889
12284
  description: "adds a member and returns the group",
11890
12285
  identity: ADMIN_SIGNED_IN,
11891
12286
  request: {
11892
- token: ADMIN4,
12287
+ token: ADMIN5,
11893
12288
  params: { groupUid: "group-admins", userUid: RESTRICTED_UID }
11894
12289
  },
11895
12290
  expect: {
@@ -11903,7 +12298,7 @@ var SASjsApi = (() => {
11903
12298
  description: "refuses a change to the reserved public group",
11904
12299
  identity: PROVIDER_MANAGED,
11905
12300
  request: {
11906
- token: ADMIN4,
12301
+ token: ADMIN5,
11907
12302
  params: { groupUid: "group-public", userUid: RESTRICTED_UID }
11908
12303
  },
11909
12304
  expect: { status: 400, error: "Can't add/remove user to 'public' group." }
@@ -11914,7 +12309,7 @@ var SASjsApi = (() => {
11914
12309
  description: "refuses a membership change by a non-administrator",
11915
12310
  identity: ADMIN_SIGNED_IN,
11916
12311
  request: {
11917
- token: RESTRICTED4,
12312
+ token: RESTRICTED5,
11918
12313
  params: { groupUid: "group-admins", userUid: RESTRICTED_UID }
11919
12314
  },
11920
12315
  expect: { status: 401, error: "Admin account required" }
@@ -11925,7 +12320,7 @@ var SASjsApi = (() => {
11925
12320
  description: "answers 404 for a group that does not exist",
11926
12321
  identity: ADMIN_SIGNED_IN,
11927
12322
  request: {
11928
- token: ADMIN4,
12323
+ token: ADMIN5,
11929
12324
  params: { groupUid: "group-none", userUid: RESTRICTED_UID }
11930
12325
  },
11931
12326
  expect: { status: 404, error: "Group not found." }
@@ -11936,7 +12331,7 @@ var SASjsApi = (() => {
11936
12331
  description: "refuses a membership change on a provider-managed group",
11937
12332
  identity: PROVIDER_MANAGED,
11938
12333
  request: {
11939
- token: ADMIN4,
12334
+ token: ADMIN5,
11940
12335
  params: { groupUid: "group-directory", userUid: RESTRICTED_UID }
11941
12336
  },
11942
12337
  expect: {
@@ -11950,7 +12345,7 @@ var SASjsApi = (() => {
11950
12345
  description: "removes a member and returns the group",
11951
12346
  identity: ADMIN_SIGNED_IN,
11952
12347
  request: {
11953
- token: ADMIN4,
12348
+ token: ADMIN5,
11954
12349
  params: { groupUid: "group-data-controller", userUid: RESTRICTED_UID }
11955
12350
  },
11956
12351
  expect: {
@@ -11964,7 +12359,7 @@ var SASjsApi = (() => {
11964
12359
  description: "refuses a membership change for a provider-managed user",
11965
12360
  identity: PROVIDER_MANAGED,
11966
12361
  request: {
11967
- token: ADMIN4,
12362
+ token: ADMIN5,
11968
12363
  params: { groupUid: "group-admins", userUid: "user-directory" }
11969
12364
  },
11970
12365
  expect: {
@@ -11978,7 +12373,7 @@ var SASjsApi = (() => {
11978
12373
  description: "refuses a membership change for a provider-managed user",
11979
12374
  identity: PROVIDER_MANAGED,
11980
12375
  request: {
11981
- token: ADMIN4,
12376
+ token: ADMIN5,
11982
12377
  params: { groupUid: "group-admins", userUid: "user-directory" }
11983
12378
  },
11984
12379
  expect: {
@@ -11992,7 +12387,7 @@ var SASjsApi = (() => {
11992
12387
  description: "refuses a change to the reserved public group",
11993
12388
  identity: PROVIDER_MANAGED,
11994
12389
  request: {
11995
- token: ADMIN4,
12390
+ token: ADMIN5,
11996
12391
  params: { groupUid: "group-public", userUid: RESTRICTED_UID }
11997
12392
  },
11998
12393
  expect: { status: 400, error: "Can't add/remove user to 'public' group." }
@@ -12003,7 +12398,7 @@ var SASjsApi = (() => {
12003
12398
  description: "refuses a membership change by a non-administrator",
12004
12399
  identity: ADMIN_SIGNED_IN,
12005
12400
  request: {
12006
- token: RESTRICTED4,
12401
+ token: RESTRICTED5,
12007
12402
  params: { groupUid: "group-data-controller", userUid: RESTRICTED_UID }
12008
12403
  },
12009
12404
  expect: { status: 401, error: "Admin account required" }
@@ -12014,7 +12409,7 @@ var SASjsApi = (() => {
12014
12409
  description: "answers 404 for a member that does not exist",
12015
12410
  identity: ADMIN_SIGNED_IN,
12016
12411
  request: {
12017
- token: ADMIN4,
12412
+ token: ADMIN5,
12018
12413
  params: { groupUid: "group-admins", userUid: "user-none" }
12019
12414
  },
12020
12415
  expect: { status: 404, error: "User not found." }
@@ -12025,7 +12420,7 @@ var SASjsApi = (() => {
12025
12420
  description: "refuses a membership change on a provider-managed group",
12026
12421
  identity: PROVIDER_MANAGED,
12027
12422
  request: {
12028
- token: ADMIN4,
12423
+ token: ADMIN5,
12029
12424
  params: { groupUid: "group-directory", userUid: RESTRICTED_UID }
12030
12425
  },
12031
12426
  expect: {
@@ -12038,7 +12433,7 @@ var SASjsApi = (() => {
12038
12433
  route: "DELETE /SASjsApi/group/{uid}",
12039
12434
  description: "deletes a group",
12040
12435
  identity: ADMIN_SIGNED_IN,
12041
- request: { token: ADMIN4, params: { uid: "group-data-controller" } },
12436
+ request: { token: ADMIN5, params: { uid: "group-data-controller" } },
12042
12437
  expect: { status: 200 }
12043
12438
  },
12044
12439
  {
@@ -12046,7 +12441,7 @@ var SASjsApi = (() => {
12046
12441
  route: "DELETE /SASjsApi/group/{uid}",
12047
12442
  description: "refuses a deletion by a caller who is not an administrator",
12048
12443
  identity: ADMIN_SIGNED_IN,
12049
- request: { token: RESTRICTED4, params: { uid: "group-admins" } },
12444
+ request: { token: RESTRICTED5, params: { uid: "group-admins" } },
12050
12445
  expect: { status: 401, error: "Admin account required" }
12051
12446
  },
12052
12447
  {
@@ -12054,7 +12449,7 @@ var SASjsApi = (() => {
12054
12449
  route: "DELETE /SASjsApi/group/{uid}",
12055
12450
  description: "answers 404 for an identifier no group has",
12056
12451
  identity: ADMIN_SIGNED_IN,
12057
- request: { token: ADMIN4, params: { uid: "group-none" } },
12452
+ request: { token: ADMIN5, params: { uid: "group-none" } },
12058
12453
  expect: { status: 404, error: "Group not found." }
12059
12454
  },
12060
12455
  // ------------------------------------------------------------ permissions
@@ -12063,7 +12458,7 @@ var SASjsApi = (() => {
12063
12458
  route: "GET /SASjsApi/info/authorizedRoutes",
12064
12459
  description: "answers the route inventory to an administrator",
12065
12460
  identity: ADMIN_SIGNED_IN,
12066
- request: { token: ADMIN4 },
12461
+ request: { token: ADMIN5 },
12067
12462
  expect: {
12068
12463
  status: 200,
12069
12464
  body: {
@@ -12087,7 +12482,7 @@ var SASjsApi = (() => {
12087
12482
  route: "GET /SASjsApi/info/authorizedRoutes",
12088
12483
  description: "refuses the inventory to a caller who is not an administrator",
12089
12484
  identity: ADMIN_SIGNED_IN,
12090
- request: { token: RESTRICTED4 },
12485
+ request: { token: RESTRICTED5 },
12091
12486
  expect: { status: 401, error: "Admin account required" }
12092
12487
  },
12093
12488
  {
@@ -12095,7 +12490,7 @@ var SASjsApi = (() => {
12095
12490
  route: "GET /SASjsApi/info/myAuthorizedRoutes",
12096
12491
  description: "answers every route to an administrator",
12097
12492
  identity: ADMIN_SIGNED_IN,
12098
- request: { token: ADMIN4 },
12493
+ request: { token: ADMIN5 },
12099
12494
  expect: {
12100
12495
  status: 200,
12101
12496
  body: {
@@ -12119,7 +12514,7 @@ var SASjsApi = (() => {
12119
12514
  route: "GET /SASjsApi/info/myAuthorizedRoutes",
12120
12515
  description: "answers a caller only the routes its rules grant",
12121
12516
  identity: ADMIN_SIGNED_IN,
12122
- request: { token: RESTRICTED4 },
12517
+ request: { token: RESTRICTED5 },
12123
12518
  expect: {
12124
12519
  status: 200,
12125
12520
  // /AppStream is visible whatever the rules say; the two grants come from
@@ -12135,7 +12530,7 @@ var SASjsApi = (() => {
12135
12530
  route: "GET /SASjsApi/permission",
12136
12531
  description: "returns every rule to an administrator",
12137
12532
  identity: ADMIN_SIGNED_IN,
12138
- request: { token: ADMIN4 },
12533
+ request: { token: ADMIN5 },
12139
12534
  expect: {
12140
12535
  status: 200,
12141
12536
  body: [
@@ -12168,7 +12563,7 @@ var SASjsApi = (() => {
12168
12563
  route: "GET /SASjsApi/permission",
12169
12564
  description: "returns a caller only their own rules and their groups'",
12170
12565
  identity: ADMIN_SIGNED_IN,
12171
- request: { token: RESTRICTED4 },
12566
+ request: { token: RESTRICTED5 },
12172
12567
  expect: {
12173
12568
  status: 200,
12174
12569
  body: [
@@ -12210,7 +12605,7 @@ var SASjsApi = (() => {
12210
12605
  description: "creates a rule for a user",
12211
12606
  identity: ADMIN_SIGNED_IN,
12212
12607
  request: {
12213
- token: ADMIN4,
12608
+ token: ADMIN5,
12214
12609
  body: {
12215
12610
  path: "/SASjsApi/drive/folder",
12216
12611
  type: "Route",
@@ -12230,7 +12625,7 @@ var SASjsApi = (() => {
12230
12625
  description: "creates a rule for a group",
12231
12626
  identity: ADMIN_SIGNED_IN,
12232
12627
  request: {
12233
- token: ADMIN4,
12628
+ token: ADMIN5,
12234
12629
  body: {
12235
12630
  path: "/SASjsApi/drive/rename",
12236
12631
  type: "Route",
@@ -12254,7 +12649,7 @@ var SASjsApi = (() => {
12254
12649
  description: "refuses a principal type that is neither a user nor a group",
12255
12650
  identity: ADMIN_SIGNED_IN,
12256
12651
  request: {
12257
- token: ADMIN4,
12652
+ token: ADMIN5,
12258
12653
  body: {
12259
12654
  path: "/SASjsApi/drive/deploy",
12260
12655
  type: "Route",
@@ -12274,7 +12669,7 @@ var SASjsApi = (() => {
12274
12669
  description: "refuses a rule assigned to an administrator",
12275
12670
  identity: ADMIN_SIGNED_IN,
12276
12671
  request: {
12277
- token: ADMIN4,
12672
+ token: ADMIN5,
12278
12673
  body: {
12279
12674
  path: "/SASjsApi/drive/folder",
12280
12675
  type: "Route",
@@ -12294,7 +12689,7 @@ var SASjsApi = (() => {
12294
12689
  description: "refuses a creation by a non-administrator",
12295
12690
  identity: ADMIN_SIGNED_IN,
12296
12691
  request: {
12297
- token: RESTRICTED4,
12692
+ token: RESTRICTED5,
12298
12693
  body: {
12299
12694
  path: "/SASjsApi/drive/folder",
12300
12695
  type: "Route",
@@ -12311,7 +12706,7 @@ var SASjsApi = (() => {
12311
12706
  description: "answers 404 for a principal that does not exist",
12312
12707
  identity: ADMIN_SIGNED_IN,
12313
12708
  request: {
12314
- token: ADMIN4,
12709
+ token: ADMIN5,
12315
12710
  body: {
12316
12711
  path: "/SASjsApi/drive/rename",
12317
12712
  type: "Route",
@@ -12328,7 +12723,7 @@ var SASjsApi = (() => {
12328
12723
  description: "refuses a group rule that already exists",
12329
12724
  identity: ADMIN_SIGNED_IN,
12330
12725
  request: {
12331
- token: ADMIN4,
12726
+ token: ADMIN5,
12332
12727
  body: {
12333
12728
  path: "/SASjsApi/drive/file",
12334
12729
  type: "Route",
@@ -12348,7 +12743,7 @@ var SASjsApi = (() => {
12348
12743
  description: "refuses a rule that already exists",
12349
12744
  identity: ADMIN_SIGNED_IN,
12350
12745
  request: {
12351
- token: ADMIN4,
12746
+ token: ADMIN5,
12352
12747
  body: {
12353
12748
  path: "/SASjsApi/code/execute",
12354
12749
  type: "Route",
@@ -12368,7 +12763,7 @@ var SASjsApi = (() => {
12368
12763
  description: "flips a rule from Deny to Grant",
12369
12764
  identity: ADMIN_SIGNED_IN,
12370
12765
  request: {
12371
- token: ADMIN4,
12766
+ token: ADMIN5,
12372
12767
  params: { uid: "rule-code" },
12373
12768
  body: { setting: "Grant" }
12374
12769
  },
@@ -12380,7 +12775,7 @@ var SASjsApi = (() => {
12380
12775
  description: "refuses a change by a non-administrator",
12381
12776
  identity: ADMIN_SIGNED_IN,
12382
12777
  request: {
12383
- token: RESTRICTED4,
12778
+ token: RESTRICTED5,
12384
12779
  params: { uid: "rule-code" },
12385
12780
  body: { setting: "Grant" }
12386
12781
  },
@@ -12392,7 +12787,7 @@ var SASjsApi = (() => {
12392
12787
  description: "answers 404 for a rule that does not exist",
12393
12788
  identity: ADMIN_SIGNED_IN,
12394
12789
  request: {
12395
- token: ADMIN4,
12790
+ token: ADMIN5,
12396
12791
  params: { uid: "rule-none" },
12397
12792
  body: { setting: "Grant" }
12398
12793
  },
@@ -12403,7 +12798,7 @@ var SASjsApi = (() => {
12403
12798
  route: "DELETE /SASjsApi/permission/{uid}",
12404
12799
  description: "deletes a rule",
12405
12800
  identity: ADMIN_SIGNED_IN,
12406
- request: { token: ADMIN4, params: { uid: "rule-code" } },
12801
+ request: { token: ADMIN5, params: { uid: "rule-code" } },
12407
12802
  expect: { status: 200, body: "Permission Deleted!" }
12408
12803
  },
12409
12804
  {
@@ -12411,7 +12806,7 @@ var SASjsApi = (() => {
12411
12806
  route: "DELETE /SASjsApi/permission/{uid}",
12412
12807
  description: "refuses a deletion by a non-administrator",
12413
12808
  identity: ADMIN_SIGNED_IN,
12414
- request: { token: RESTRICTED4, params: { uid: "rule-code" } },
12809
+ request: { token: RESTRICTED5, params: { uid: "rule-code" } },
12415
12810
  expect: { status: 401, error: "Admin account required" }
12416
12811
  },
12417
12812
  {
@@ -12419,7 +12814,7 @@ var SASjsApi = (() => {
12419
12814
  route: "DELETE /SASjsApi/permission/{uid}",
12420
12815
  description: "answers 404 for a rule that does not exist",
12421
12816
  identity: ADMIN_SIGNED_IN,
12422
- request: { token: ADMIN4, params: { uid: "rule-none" } },
12817
+ request: { token: ADMIN5, params: { uid: "rule-none" } },
12423
12818
  expect: { status: 404, error: "Permission not found." }
12424
12819
  },
12425
12820
  // --------------------------------------------------------------- clients
@@ -12428,7 +12823,7 @@ var SASjsApi = (() => {
12428
12823
  route: "GET /SASjsApi/client",
12429
12824
  description: "lists the registered clients",
12430
12825
  identity: ADMIN_SIGNED_IN,
12431
- request: { token: ADMIN4 },
12826
+ request: { token: ADMIN5 },
12432
12827
  expect: {
12433
12828
  status: 200,
12434
12829
  body: [
@@ -12452,7 +12847,7 @@ var SASjsApi = (() => {
12452
12847
  route: "GET /SASjsApi/client",
12453
12848
  description: "refuses the list to a caller who is not an administrator",
12454
12849
  identity: ADMIN_SIGNED_IN,
12455
- request: { token: RESTRICTED4 },
12850
+ request: { token: RESTRICTED5 },
12456
12851
  expect: { status: 401, error: "Admin account required" }
12457
12852
  },
12458
12853
  {
@@ -12461,7 +12856,7 @@ var SASjsApi = (() => {
12461
12856
  description: "registers a client",
12462
12857
  identity: ADMIN_SIGNED_IN,
12463
12858
  request: {
12464
- token: ADMIN4,
12859
+ token: ADMIN5,
12465
12860
  body: {
12466
12861
  clientId: "new_app",
12467
12862
  clientSecret: "new_secret",
@@ -12485,7 +12880,7 @@ var SASjsApi = (() => {
12485
12880
  description: "applies the schema defaults when the lifetimes are omitted",
12486
12881
  identity: ADMIN_SIGNED_IN,
12487
12882
  request: {
12488
- token: ADMIN4,
12883
+ token: ADMIN5,
12489
12884
  body: { clientId: "default_app", clientSecret: "default_secret" }
12490
12885
  },
12491
12886
  expect: {
@@ -12504,7 +12899,7 @@ var SASjsApi = (() => {
12504
12899
  description: "refuses a registration by a non-administrator",
12505
12900
  identity: ADMIN_SIGNED_IN,
12506
12901
  request: {
12507
- token: RESTRICTED4,
12902
+ token: RESTRICTED5,
12508
12903
  body: {
12509
12904
  clientId: "new_app",
12510
12905
  clientSecret: "new_secret",
@@ -12520,7 +12915,7 @@ var SASjsApi = (() => {
12520
12915
  description: "refuses a client id that is registered, with the 403 the server sends",
12521
12916
  identity: ADMIN_SIGNED_IN,
12522
12917
  request: {
12523
- token: ADMIN4,
12918
+ token: ADMIN5,
12524
12919
  body: {
12525
12920
  clientId: "web_app",
12526
12921
  clientSecret: "other",
@@ -12537,7 +12932,7 @@ var SASjsApi = (() => {
12537
12932
  description: "changes the caller’s own password",
12538
12933
  identity: ADMIN_SIGNED_IN,
12539
12934
  request: {
12540
- token: RESTRICTED4,
12935
+ token: RESTRICTED5,
12541
12936
  body: { currentPassword: "Orion123", newPassword: "changed123" }
12542
12937
  },
12543
12938
  expect: { status: 204 }
@@ -12547,7 +12942,7 @@ var SASjsApi = (() => {
12547
12942
  route: "PATCH /SASjsApi/auth/updatePassword",
12548
12943
  description: "refuses a body without the current password",
12549
12944
  identity: ADMIN_SIGNED_IN,
12550
- request: { token: RESTRICTED4, body: { newPassword: "changed123" } },
12945
+ request: { token: RESTRICTED5, body: { newPassword: "changed123" } },
12551
12946
  expect: { status: 400, error: '"currentPassword" is required' }
12552
12947
  },
12553
12948
  {
@@ -12566,7 +12961,7 @@ var SASjsApi = (() => {
12566
12961
  description: "refuses a change whose current password is wrong",
12567
12962
  identity: ADMIN_SIGNED_IN,
12568
12963
  request: {
12569
- token: RESTRICTED4,
12964
+ token: RESTRICTED5,
12570
12965
  body: { currentPassword: "wrong", newPassword: "changed123" }
12571
12966
  },
12572
12967
  expect: { status: 403, error: "Invalid current password!" }