@sasjs/api 0.41.0 → 0.43.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 +262 -160
- package/build/cjs/code/service.js +3 -1
- package/build/cjs/corpus/admin.js +40 -8
- package/build/cjs/corpus/runtime.js +24 -0
- package/build/cjs/host/dispatch.js +78 -14
- package/build/cjs/identity/records.js +70 -29
- package/build/cjs/routes/overlay.js +5 -6
- package/build/esm/code/service.d.ts +7 -1
- package/build/esm/code/service.d.ts.map +1 -1
- package/build/esm/code/service.js +3 -1
- package/build/esm/corpus/admin.d.ts +4 -3
- package/build/esm/corpus/admin.d.ts.map +1 -1
- package/build/esm/corpus/admin.js +40 -8
- package/build/esm/corpus/runtime.d.ts.map +1 -1
- package/build/esm/corpus/runtime.js +24 -0
- package/build/esm/host/dispatch.d.ts.map +1 -1
- package/build/esm/host/dispatch.js +78 -14
- package/build/esm/identity/records.d.ts +35 -0
- package/build/esm/identity/records.d.ts.map +1 -1
- package/build/esm/identity/records.js +70 -29
- package/build/esm/routes/overlay.d.ts.map +1 -1
- package/build/esm/routes/overlay.js +5 -6
- package/package.json +3 -2
package/build/browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @sasjs/api 0.
|
|
1
|
+
/* @sasjs/api 0.43.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;
|
|
@@ -3330,12 +3330,11 @@ var SASjsApi = (() => {
|
|
|
3330
3330
|
responses: { 200: "OK!" }
|
|
3331
3331
|
},
|
|
3332
3332
|
// Admin - the host's own process and files, over the reports it supplies.
|
|
3333
|
-
// The administrator check is the
|
|
3334
|
-
//
|
|
3335
|
-
// - and the 500 a genuine failure answers - are host-only statuses.
|
|
3333
|
+
// The administrator check is the package's, so its 401 is a case like any
|
|
3334
|
+
// other; the 500 a genuine failure answers stays the host's.
|
|
3336
3335
|
"GET /SASjsApi/admin/diagnostics": {
|
|
3337
3336
|
implemented: true,
|
|
3338
|
-
hostResponses: [
|
|
3337
|
+
hostResponses: [500],
|
|
3339
3338
|
responses: {
|
|
3340
3339
|
200: {
|
|
3341
3340
|
build: { version: "", gitHash: "", buildDate: null },
|
|
@@ -3375,14 +3374,14 @@ var SASjsApi = (() => {
|
|
|
3375
3374
|
},
|
|
3376
3375
|
"GET /SASjsApi/admin/logs": {
|
|
3377
3376
|
implemented: true,
|
|
3378
|
-
hostResponses: [
|
|
3377
|
+
hostResponses: [500],
|
|
3379
3378
|
responses: { 200: { files: [] } }
|
|
3380
3379
|
},
|
|
3381
3380
|
"GET /SASjsApi/admin/logs/{fileName}": {
|
|
3382
3381
|
implemented: true,
|
|
3383
3382
|
// 400 and 404 are the name rule's, and this package answers them before the
|
|
3384
3383
|
// host is asked for anything
|
|
3385
|
-
hostResponses: [
|
|
3384
|
+
hostResponses: [500],
|
|
3386
3385
|
responses: {
|
|
3387
3386
|
200: {
|
|
3388
3387
|
fileName: "",
|
|
@@ -6671,6 +6670,16 @@ var SASjsApi = (() => {
|
|
|
6671
6670
|
"POST /SASjsApi/code/execute",
|
|
6672
6671
|
"POST /SASjsApi/code/trigger"
|
|
6673
6672
|
];
|
|
6673
|
+
var GRANTED_RUN_ROUTES = [
|
|
6674
|
+
"GET /SASjsApi/stp/execute",
|
|
6675
|
+
"POST /SASjsApi/stp/execute",
|
|
6676
|
+
"POST /SASjsApi/code/execute"
|
|
6677
|
+
];
|
|
6678
|
+
var ADMIN_ROUTES = [
|
|
6679
|
+
"GET /SASjsApi/admin/diagnostics",
|
|
6680
|
+
"GET /SASjsApi/admin/logs",
|
|
6681
|
+
"GET /SASjsApi/admin/logs/{fileName}"
|
|
6682
|
+
];
|
|
6674
6683
|
var given = (value) => typeof value === "string" && value !== "" ? value : void 0;
|
|
6675
6684
|
var replaceOf = (value) => {
|
|
6676
6685
|
if (value === void 0 || value === "") return void 0;
|
|
@@ -6711,9 +6720,25 @@ var SASjsApi = (() => {
|
|
|
6711
6720
|
const { drive, identity, records, code } = services;
|
|
6712
6721
|
const identityScoped = ["User", "Group", "Permission", "Client"].includes(route.tag) || routeId === "PATCH /SASjsApi/auth/updatePassword";
|
|
6713
6722
|
const runtimeScoped = RUN_ROUTES.includes(routeId);
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6723
|
+
const adminScoped = ADMIN_ROUTES.includes(routeId) && Boolean(services.admin);
|
|
6724
|
+
const grantScoped = Boolean(records) && GRANTED_RUN_ROUTES.includes(routeId);
|
|
6725
|
+
if (adminScoped && !records)
|
|
6726
|
+
throw new ApiError(
|
|
6727
|
+
501,
|
|
6728
|
+
`This host has no record service, so it cannot answer ${routeId}.`
|
|
6729
|
+
);
|
|
6730
|
+
let subject = request.subject;
|
|
6731
|
+
let subjectResolved = Boolean(request.subject);
|
|
6732
|
+
const caller = async () => {
|
|
6733
|
+
if (!subjectResolved) {
|
|
6734
|
+
subject = identity ? await identity.authenticate(request.token) : void 0;
|
|
6735
|
+
subjectResolved = true;
|
|
6736
|
+
}
|
|
6737
|
+
return subject;
|
|
6738
|
+
};
|
|
6739
|
+
if (identityScoped && records || runtimeScoped && services.runtime || adminScoped || grantScoped) {
|
|
6740
|
+
const callerSubject = await caller();
|
|
6741
|
+
if (!callerSubject) {
|
|
6717
6742
|
if (!identity)
|
|
6718
6743
|
throw new ApiError(
|
|
6719
6744
|
501,
|
|
@@ -6721,6 +6746,13 @@ var SASjsApi = (() => {
|
|
|
6721
6746
|
);
|
|
6722
6747
|
throw new ApiError(401, "Unauthorized");
|
|
6723
6748
|
}
|
|
6749
|
+
if (adminScoped && !await records.mayAdminister(callerSubject)) {
|
|
6750
|
+
if (!await records.mayAct(callerSubject))
|
|
6751
|
+
throw new ApiError(401, "Unauthorized");
|
|
6752
|
+
throw new ApiError(401, "Admin account required");
|
|
6753
|
+
}
|
|
6754
|
+
if (grantScoped && !await records.mayUseRoute(callerSubject, route.path))
|
|
6755
|
+
throw new ApiError(401, "Unauthorized");
|
|
6724
6756
|
}
|
|
6725
6757
|
validate(route, request);
|
|
6726
6758
|
const query = request.query || {};
|
|
@@ -6762,10 +6794,6 @@ var SASjsApi = (() => {
|
|
|
6762
6794
|
);
|
|
6763
6795
|
return records;
|
|
6764
6796
|
};
|
|
6765
|
-
const caller = async () => {
|
|
6766
|
-
if (request.subject) return request.subject;
|
|
6767
|
-
return identity?.authenticate(request.token);
|
|
6768
|
-
};
|
|
6769
6797
|
if (routeId.startsWith("POST /SASjsApi/auth/") || routeId.startsWith("POST /SASLogon/") || routeId === "GET /SASLogon/logout" || routeId === "GET /SASjsApi/session") {
|
|
6770
6798
|
if (!identity)
|
|
6771
6799
|
throw new ApiError(
|
|
@@ -6834,10 +6862,11 @@ var SASjsApi = (() => {
|
|
|
6834
6862
|
}
|
|
6835
6863
|
// ------------------------------------------------- a host's own reports
|
|
6836
6864
|
//
|
|
6837
|
-
// The administrator
|
|
6838
|
-
//
|
|
6839
|
-
//
|
|
6840
|
-
//
|
|
6865
|
+
// The administrator check is the package's, from the caller the transport
|
|
6866
|
+
// resolved: `mayAdminister` is the decision `verifyAdmin` makes on a server,
|
|
6867
|
+
// asked here so a browser host that supplies these reports cannot serve them
|
|
6868
|
+
// to anyone who asks. What stays the host's is the body, and for a log tail
|
|
6869
|
+
// the refusals that belong to the name rule.
|
|
6841
6870
|
case "GET /SASjsApi/admin/diagnostics": {
|
|
6842
6871
|
if (!services.admin)
|
|
6843
6872
|
throw new ApiError(
|
|
@@ -7566,10 +7595,14 @@ var SASjsApi = (() => {
|
|
|
7566
7595
|
var ALL_USERS_GROUP = "all-users";
|
|
7567
7596
|
var PUBLIC_GROUP = "public";
|
|
7568
7597
|
var unauthorized2 = () => new ApiError(401, "Unauthorized");
|
|
7569
|
-
var
|
|
7570
|
-
if (!caller)
|
|
7598
|
+
var readerOf = async (store, caller) => {
|
|
7599
|
+
if (!caller) return void 0;
|
|
7571
7600
|
const user3 = await store.userById(caller.userId);
|
|
7572
|
-
|
|
7601
|
+
return user3 && user3.isActive ? user3 : void 0;
|
|
7602
|
+
};
|
|
7603
|
+
var requireCaller = async (store, caller) => {
|
|
7604
|
+
const user3 = await readerOf(store, caller);
|
|
7605
|
+
if (!user3) throw unauthorized2();
|
|
7573
7606
|
return user3;
|
|
7574
7607
|
};
|
|
7575
7608
|
var requireAdmin = async (store, caller) => {
|
|
@@ -7598,6 +7631,25 @@ var SASjsApi = (() => {
|
|
|
7598
7631
|
});
|
|
7599
7632
|
var createRecordService = (store, options = {}) => {
|
|
7600
7633
|
const grantableRoutes = options.grantableRoutes || DEFAULT_GRANTABLE_ROUTES;
|
|
7634
|
+
const grantedRoutesFor = async (reader) => {
|
|
7635
|
+
if (reader.isAdmin) return new Set(grantableRoutes);
|
|
7636
|
+
const rules = await store.permissions();
|
|
7637
|
+
const mine = {
|
|
7638
|
+
user: rules.filter((rule) => rule.user === reader.uid).map((rule) => ({ path: rule.path, setting: rule.setting })),
|
|
7639
|
+
group: rules.filter(
|
|
7640
|
+
(rule) => rule.group !== void 0 && reader.groups.includes(rule.group)
|
|
7641
|
+
).map((rule) => ({ path: rule.path, setting: rule.setting }))
|
|
7642
|
+
};
|
|
7643
|
+
const publicGroup = rules.some((rule) => rule.group !== void 0) ? (await store.groups()).find((group) => group.name === PUBLIC_GROUP) : void 0;
|
|
7644
|
+
const publicGrants = publicGroup ? rules.filter(
|
|
7645
|
+
(rule) => rule.group === publicGroup.uid && rule.setting === "Grant"
|
|
7646
|
+
).map((rule) => rule.path) : [];
|
|
7647
|
+
return new Set(
|
|
7648
|
+
grantableRoutes.filter(
|
|
7649
|
+
(path) => ALWAYS_VISIBLE_ROUTES.includes(path) || publicGrants.includes(path) || isRouteGranted(mine, path, topLevelRouteFor(path))
|
|
7650
|
+
)
|
|
7651
|
+
);
|
|
7652
|
+
};
|
|
7601
7653
|
const groupDetails = async (group) => {
|
|
7602
7654
|
const members = [];
|
|
7603
7655
|
for (const uid of group.users) {
|
|
@@ -7791,25 +7843,22 @@ var SASjsApi = (() => {
|
|
|
7791
7843
|
},
|
|
7792
7844
|
async myAuthorizedRoutes(caller) {
|
|
7793
7845
|
const reader = await requireCaller(store, caller);
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
const
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
(path) => ALWAYS_VISIBLE_ROUTES.includes(path) || publicGrants.includes(path) || isRouteGranted(mine, path, topLevelRouteFor(path))
|
|
7811
|
-
)
|
|
7812
|
-
};
|
|
7846
|
+
const granted = await grantedRoutesFor(reader);
|
|
7847
|
+
return { paths: grantableRoutes.filter((path) => granted.has(path)) };
|
|
7848
|
+
},
|
|
7849
|
+
async mayAdminister(caller) {
|
|
7850
|
+
const reader = await readerOf(store, caller);
|
|
7851
|
+
return Boolean(reader?.isAdmin);
|
|
7852
|
+
},
|
|
7853
|
+
async mayAct(caller) {
|
|
7854
|
+
return Boolean(await readerOf(store, caller));
|
|
7855
|
+
},
|
|
7856
|
+
async mayUseRoute(caller, path) {
|
|
7857
|
+
const reader = await readerOf(store, caller);
|
|
7858
|
+
if (!reader) return false;
|
|
7859
|
+
if (reader.isAdmin) return true;
|
|
7860
|
+
const granted = await grantedRoutesFor(reader);
|
|
7861
|
+
return granted.has(path);
|
|
7813
7862
|
},
|
|
7814
7863
|
async listPermissions(caller) {
|
|
7815
7864
|
const reader = await requireCaller(store, caller);
|
|
@@ -8069,41 +8118,71 @@ var SASjsApi = (() => {
|
|
|
8069
8118
|
newestModified: CORPUS_LOG.modified
|
|
8070
8119
|
}
|
|
8071
8120
|
};
|
|
8121
|
+
var ADMIN = { userId: "user-admin", clientId: "web_app" };
|
|
8122
|
+
var RESTRICTED = { userId: "user-restricted", clientId: "web_app" };
|
|
8072
8123
|
var ADMIN_CORPUS = [
|
|
8073
8124
|
{
|
|
8074
8125
|
id: "admin-diagnostics-answers-the-report",
|
|
8075
8126
|
route: "GET /SASjsApi/admin/diagnostics",
|
|
8076
8127
|
description: "answers the host diagnostics report field for field",
|
|
8077
|
-
request: {},
|
|
8128
|
+
request: { subject: ADMIN },
|
|
8078
8129
|
expect: { status: 200, body: CORPUS_DIAGNOSTICS }
|
|
8079
8130
|
},
|
|
8080
8131
|
{
|
|
8081
8132
|
id: "admin-logs-lists-the-files",
|
|
8082
8133
|
route: "GET /SASjsApi/admin/logs",
|
|
8083
8134
|
description: "answers the log files the host holds, newest first",
|
|
8084
|
-
request: {},
|
|
8135
|
+
request: { subject: ADMIN },
|
|
8085
8136
|
expect: { status: 200, body: { files: [CORPUS_LOG] } }
|
|
8086
8137
|
},
|
|
8087
8138
|
{
|
|
8088
8139
|
id: "admin-log-tail-answers-the-tail",
|
|
8089
8140
|
route: "GET /SASjsApi/admin/logs/{fileName}",
|
|
8090
8141
|
description: "answers the tail of a log the folder holds",
|
|
8091
|
-
request: { params: { fileName: CORPUS_LOG.name } },
|
|
8142
|
+
request: { subject: ADMIN, params: { fileName: CORPUS_LOG.name } },
|
|
8092
8143
|
expect: { status: 200, body: CORPUS_LOG_TAIL }
|
|
8093
8144
|
},
|
|
8094
8145
|
{
|
|
8095
8146
|
id: "admin-log-tail-refuses-a-traversal",
|
|
8096
8147
|
route: "GET /SASjsApi/admin/logs/{fileName}",
|
|
8097
8148
|
description: "refuses a name that could resolve outside the log folder, before the host is asked",
|
|
8098
|
-
request: { params: { fileName: "../20260101000000.log" } },
|
|
8149
|
+
request: { subject: ADMIN, params: { fileName: "../20260101000000.log" } },
|
|
8099
8150
|
expect: { status: 400, error: "Invalid log file name." }
|
|
8100
8151
|
},
|
|
8101
8152
|
{
|
|
8102
8153
|
id: "admin-log-tail-answers-404",
|
|
8103
8154
|
route: "GET /SASjsApi/admin/logs/{fileName}",
|
|
8104
8155
|
description: "answers 404 for a name the folder does not hold",
|
|
8105
|
-
request: { params: { fileName: "20250101000000.log" } },
|
|
8156
|
+
request: { subject: ADMIN, params: { fileName: "20250101000000.log" } },
|
|
8106
8157
|
expect: { status: 404, error: "Log file not found." }
|
|
8158
|
+
},
|
|
8159
|
+
{
|
|
8160
|
+
id: "admin-diagnostics-refused-to-a-restricted-account",
|
|
8161
|
+
route: "GET /SASjsApi/admin/diagnostics",
|
|
8162
|
+
description: "refuses a signed-in account that is not an administrator, in the wording verifyAdmin uses",
|
|
8163
|
+
request: { subject: RESTRICTED },
|
|
8164
|
+
expect: { status: 401, error: "Admin account required" }
|
|
8165
|
+
},
|
|
8166
|
+
{
|
|
8167
|
+
id: "admin-logs-refused-to-a-restricted-account",
|
|
8168
|
+
route: "GET /SASjsApi/admin/logs",
|
|
8169
|
+
description: "refuses the log inventory to a restricted account",
|
|
8170
|
+
request: { subject: RESTRICTED },
|
|
8171
|
+
expect: { status: 401, error: "Admin account required" }
|
|
8172
|
+
},
|
|
8173
|
+
{
|
|
8174
|
+
id: "admin-log-tail-refused-to-a-restricted-account",
|
|
8175
|
+
route: "GET /SASjsApi/admin/logs/{fileName}",
|
|
8176
|
+
description: "refuses a log tail to a restricted account",
|
|
8177
|
+
request: { subject: RESTRICTED, params: { fileName: CORPUS_LOG.name } },
|
|
8178
|
+
expect: { status: 401, error: "Admin account required" }
|
|
8179
|
+
},
|
|
8180
|
+
{
|
|
8181
|
+
id: "admin-logs-refused-with-no-caller",
|
|
8182
|
+
route: "GET /SASjsApi/admin/logs",
|
|
8183
|
+
description: "refuses a request that carries no caller at all",
|
|
8184
|
+
request: {},
|
|
8185
|
+
expect: { status: 401, error: "Unauthorized" }
|
|
8107
8186
|
}
|
|
8108
8187
|
];
|
|
8109
8188
|
|
|
@@ -10862,8 +10941,8 @@ var SASjsApi = (() => {
|
|
|
10862
10941
|
];
|
|
10863
10942
|
|
|
10864
10943
|
// src/corpus/session.ts
|
|
10865
|
-
var
|
|
10866
|
-
var
|
|
10944
|
+
var ADMIN2 = { userId: "user-admin", clientId: "web_app" };
|
|
10945
|
+
var RESTRICTED2 = { userId: "user-restricted", clientId: "web_app" };
|
|
10867
10946
|
var notFound2 = (id) => `Session with ID '${id}' was not found.`;
|
|
10868
10947
|
var UNAUTHORIZED = "Unauthorized";
|
|
10869
10948
|
var SESSION_CORPUS = [
|
|
@@ -10872,7 +10951,7 @@ var SASjsApi = (() => {
|
|
|
10872
10951
|
id: "session-summary-own",
|
|
10873
10952
|
route: "GET /SASjsApi/session/{sessionId}",
|
|
10874
10953
|
description: "answers the owner the summary of their own session",
|
|
10875
|
-
request: { subject:
|
|
10954
|
+
request: { subject: ADMIN2, params: { sessionId: "sess-admin" } },
|
|
10876
10955
|
expect: {
|
|
10877
10956
|
status: 200,
|
|
10878
10957
|
body: {
|
|
@@ -10889,7 +10968,7 @@ var SASjsApi = (() => {
|
|
|
10889
10968
|
id: "session-summary-as-admin",
|
|
10890
10969
|
route: "GET /SASjsApi/session/{sessionId}",
|
|
10891
10970
|
description: "answers an administrator another account's session",
|
|
10892
|
-
request: { subject:
|
|
10971
|
+
request: { subject: ADMIN2, params: { sessionId: "sess-restricted" } },
|
|
10893
10972
|
// both stamps: the document requires them, and this host stamps a session's
|
|
10894
10973
|
// death time at creation rather than at completion - a running session
|
|
10895
10974
|
// answers with the moment it is due to be destroyed
|
|
@@ -10915,14 +10994,14 @@ var SASjsApi = (() => {
|
|
|
10915
10994
|
id: "session-summary-foreign",
|
|
10916
10995
|
route: "GET /SASjsApi/session/{sessionId}",
|
|
10917
10996
|
description: "answers 404 for another account's session, not 403",
|
|
10918
|
-
request: { subject:
|
|
10997
|
+
request: { subject: RESTRICTED2, params: { sessionId: "sess-admin" } },
|
|
10919
10998
|
expect: { status: 404, error: notFound2("sess-admin") }
|
|
10920
10999
|
},
|
|
10921
11000
|
{
|
|
10922
11001
|
id: "session-summary-unknown",
|
|
10923
11002
|
route: "GET /SASjsApi/session/{sessionId}",
|
|
10924
11003
|
description: "answers the same 404 for a session that does not exist",
|
|
10925
|
-
request: { subject:
|
|
11004
|
+
request: { subject: ADMIN2, params: { sessionId: "sess-nope" } },
|
|
10926
11005
|
expect: { status: 404, error: notFound2("sess-nope") }
|
|
10927
11006
|
},
|
|
10928
11007
|
// -------------------------------------------------------------------- log
|
|
@@ -10930,7 +11009,7 @@ var SASjsApi = (() => {
|
|
|
10930
11009
|
id: "session-log-own",
|
|
10931
11010
|
route: "GET /SASjsApi/session/{sessionId}/log",
|
|
10932
11011
|
description: "answers the log this session wrote",
|
|
10933
|
-
request: { subject:
|
|
11012
|
+
request: { subject: ADMIN2, params: { sessionId: "sess-admin" } },
|
|
10934
11013
|
expect: {
|
|
10935
11014
|
status: 200,
|
|
10936
11015
|
contents: "NOTE: session started\nNOTE: session completed\n"
|
|
@@ -10940,7 +11019,7 @@ var SASjsApi = (() => {
|
|
|
10940
11019
|
id: "session-log-nothing-written",
|
|
10941
11020
|
route: "GET /SASjsApi/session/{sessionId}/log",
|
|
10942
11021
|
description: "answers an empty body for a session that has written nothing",
|
|
10943
|
-
request: { subject:
|
|
11022
|
+
request: { subject: ADMIN2, params: { sessionId: "sess-silent" } },
|
|
10944
11023
|
expect: { status: 200, contents: "" }
|
|
10945
11024
|
},
|
|
10946
11025
|
{
|
|
@@ -10954,7 +11033,7 @@ var SASjsApi = (() => {
|
|
|
10954
11033
|
id: "session-log-foreign",
|
|
10955
11034
|
route: "GET /SASjsApi/session/{sessionId}/log",
|
|
10956
11035
|
description: "will not read another account's log",
|
|
10957
|
-
request: { subject:
|
|
11036
|
+
request: { subject: RESTRICTED2, params: { sessionId: "sess-admin" } },
|
|
10958
11037
|
expect: { status: 404, error: notFound2("sess-admin") }
|
|
10959
11038
|
},
|
|
10960
11039
|
// ----------------------------------------------------------------- output
|
|
@@ -10962,7 +11041,7 @@ var SASjsApi = (() => {
|
|
|
10962
11041
|
id: "session-output-own",
|
|
10963
11042
|
route: "GET /SASjsApi/session/{sessionId}/output",
|
|
10964
11043
|
description: "answers the webout this session produced",
|
|
10965
|
-
request: { subject:
|
|
11044
|
+
request: { subject: ADMIN2, params: { sessionId: "sess-admin" } },
|
|
10966
11045
|
expect: { status: 200, contents: "<html><body>42</body></html>" }
|
|
10967
11046
|
},
|
|
10968
11047
|
{
|
|
@@ -10976,7 +11055,7 @@ var SASjsApi = (() => {
|
|
|
10976
11055
|
id: "session-output-foreign",
|
|
10977
11056
|
route: "GET /SASjsApi/session/{sessionId}/output",
|
|
10978
11057
|
description: "will not read another account's webout",
|
|
10979
|
-
request: { subject:
|
|
11058
|
+
request: { subject: RESTRICTED2, params: { sessionId: "sess-admin" } },
|
|
10980
11059
|
expect: { status: 404, error: notFound2("sess-admin") }
|
|
10981
11060
|
},
|
|
10982
11061
|
// ------------------------------------------------------------------ state
|
|
@@ -10984,7 +11063,7 @@ var SASjsApi = (() => {
|
|
|
10984
11063
|
id: "session-state-own",
|
|
10985
11064
|
route: "GET /SASjsApi/session/{sessionId}/state",
|
|
10986
11065
|
description: "answers the run time's state for this session",
|
|
10987
|
-
request: { subject:
|
|
11066
|
+
request: { subject: RESTRICTED2, params: { sessionId: "sess-restricted" } },
|
|
10988
11067
|
// the state alone: the document's SessionStateResponse permits no other
|
|
10989
11068
|
// property, and `sasjs/server` answers exactly this object
|
|
10990
11069
|
expect: { status: 200, body: { state: "running" } }
|
|
@@ -11000,13 +11079,14 @@ var SASjsApi = (() => {
|
|
|
11000
11079
|
id: "session-state-foreign",
|
|
11001
11080
|
route: "GET /SASjsApi/session/{sessionId}/state",
|
|
11002
11081
|
description: "will not report another account's session state",
|
|
11003
|
-
request: { subject:
|
|
11082
|
+
request: { subject: RESTRICTED2, params: { sessionId: "sess-admin" } },
|
|
11004
11083
|
expect: { status: 404, error: notFound2("sess-admin") }
|
|
11005
11084
|
}
|
|
11006
11085
|
];
|
|
11007
11086
|
|
|
11008
11087
|
// src/corpus/runtime.ts
|
|
11009
|
-
var
|
|
11088
|
+
var ADMIN3 = { userId: "user-admin", clientId: "web_app" };
|
|
11089
|
+
var RESTRICTED3 = { userId: "user-restricted", clientId: "web_app" };
|
|
11010
11090
|
var PROGRAM = "/Public/apps/demo/run.sas";
|
|
11011
11091
|
var CODE = 'data _null_;\n put "hello";\nrun;';
|
|
11012
11092
|
var UNAUTHORIZED2 = "Unauthorized";
|
|
@@ -11018,7 +11098,7 @@ var SASjsApi = (() => {
|
|
|
11018
11098
|
id: "stp-execute-get-answers-output",
|
|
11019
11099
|
route: "GET /SASjsApi/stp/execute",
|
|
11020
11100
|
description: "answers the output the program produced",
|
|
11021
|
-
request: { subject:
|
|
11101
|
+
request: { subject: ADMIN3, query: { _program: PROGRAM } },
|
|
11022
11102
|
runOutput: { contents: "hello from the program" },
|
|
11023
11103
|
expect: { status: 200, contents: "hello from the program" }
|
|
11024
11104
|
},
|
|
@@ -11026,7 +11106,7 @@ var SASjsApi = (() => {
|
|
|
11026
11106
|
id: "stp-execute-get-answers-bytes",
|
|
11027
11107
|
route: "GET /SASjsApi/stp/execute",
|
|
11028
11108
|
description: "answers an output that is bytes as bytes",
|
|
11029
|
-
request: { subject:
|
|
11109
|
+
request: { subject: ADMIN3, query: { _program: PROGRAM } },
|
|
11030
11110
|
runOutput: { contents: bytes2(1, 2, 3) },
|
|
11031
11111
|
expect: { status: 200, contents: bytes2(1, 2, 3) }
|
|
11032
11112
|
},
|
|
@@ -11034,14 +11114,14 @@ var SASjsApi = (() => {
|
|
|
11034
11114
|
id: "stp-execute-get-missing-program",
|
|
11035
11115
|
route: "GET /SASjsApi/stp/execute",
|
|
11036
11116
|
description: "refuses a request that names no program",
|
|
11037
|
-
request: { subject:
|
|
11117
|
+
request: { subject: ADMIN3, query: {} },
|
|
11038
11118
|
expect: { status: 400, error: '"_program" is required' }
|
|
11039
11119
|
},
|
|
11040
11120
|
{
|
|
11041
11121
|
id: "stp-execute-get-failed-run",
|
|
11042
11122
|
route: "GET /SASjsApi/stp/execute",
|
|
11043
11123
|
description: "answers 400 when the program could not be run",
|
|
11044
|
-
request: { subject:
|
|
11124
|
+
request: { subject: ADMIN3, query: { _program: PROGRAM } },
|
|
11045
11125
|
failingRun: true,
|
|
11046
11126
|
expect: { status: 400, error: FAILED }
|
|
11047
11127
|
},
|
|
@@ -11057,7 +11137,7 @@ var SASjsApi = (() => {
|
|
|
11057
11137
|
id: "stp-execute-post-body-program",
|
|
11058
11138
|
route: "POST /SASjsApi/stp/execute",
|
|
11059
11139
|
description: "runs the program the body names",
|
|
11060
|
-
request: { subject:
|
|
11140
|
+
request: { subject: ADMIN3, body: { _program: PROGRAM } },
|
|
11061
11141
|
runOutput: { contents: "hello from the body" },
|
|
11062
11142
|
expect: { status: 200, contents: "hello from the body" }
|
|
11063
11143
|
},
|
|
@@ -11065,7 +11145,7 @@ var SASjsApi = (() => {
|
|
|
11065
11145
|
id: "stp-execute-post-query-program",
|
|
11066
11146
|
route: "POST /SASjsApi/stp/execute",
|
|
11067
11147
|
description: "runs the program the query names, with no body",
|
|
11068
|
-
request: { subject:
|
|
11148
|
+
request: { subject: ADMIN3, query: { _program: PROGRAM }, body: {} },
|
|
11069
11149
|
runOutput: { contents: "hello from the query" },
|
|
11070
11150
|
expect: { status: 200, contents: "hello from the query" }
|
|
11071
11151
|
},
|
|
@@ -11073,14 +11153,14 @@ var SASjsApi = (() => {
|
|
|
11073
11153
|
id: "stp-execute-post-no-program",
|
|
11074
11154
|
route: "POST /SASjsApi/stp/execute",
|
|
11075
11155
|
description: "refuses a request with no program in the query or the body",
|
|
11076
|
-
request: { subject:
|
|
11156
|
+
request: { subject: ADMIN3, body: {} },
|
|
11077
11157
|
expect: { status: 400, error: '"_program" is required' }
|
|
11078
11158
|
},
|
|
11079
11159
|
{
|
|
11080
11160
|
id: "stp-execute-post-failed-run",
|
|
11081
11161
|
route: "POST /SASjsApi/stp/execute",
|
|
11082
11162
|
description: "answers 400 when the program could not be run",
|
|
11083
|
-
request: { subject:
|
|
11163
|
+
request: { subject: ADMIN3, body: { _program: PROGRAM } },
|
|
11084
11164
|
failingRun: true,
|
|
11085
11165
|
expect: { status: 400, error: FAILED }
|
|
11086
11166
|
},
|
|
@@ -11096,7 +11176,7 @@ var SASjsApi = (() => {
|
|
|
11096
11176
|
id: "stp-trigger-answers-session",
|
|
11097
11177
|
route: "POST /SASjsApi/stp/trigger",
|
|
11098
11178
|
description: "answers the session a caller polls, and no pid from a mock",
|
|
11099
|
-
request: { subject:
|
|
11179
|
+
request: { subject: ADMIN3, query: { _program: PROGRAM } },
|
|
11100
11180
|
expect: { status: 200, keys: ["sessionId"] }
|
|
11101
11181
|
},
|
|
11102
11182
|
{
|
|
@@ -11104,7 +11184,7 @@ var SASjsApi = (() => {
|
|
|
11104
11184
|
route: "POST /SASjsApi/stp/trigger",
|
|
11105
11185
|
description: "accepts a retention in minutes, as the query carries it",
|
|
11106
11186
|
request: {
|
|
11107
|
-
subject:
|
|
11187
|
+
subject: ADMIN3,
|
|
11108
11188
|
query: { _program: PROGRAM, expiresAfterMins: "15" }
|
|
11109
11189
|
},
|
|
11110
11190
|
expect: { status: 200, keys: ["sessionId"] }
|
|
@@ -11114,7 +11194,7 @@ var SASjsApi = (() => {
|
|
|
11114
11194
|
route: "POST /SASjsApi/stp/trigger",
|
|
11115
11195
|
description: "refuses a retention that is not a positive number of minutes",
|
|
11116
11196
|
request: {
|
|
11117
|
-
subject:
|
|
11197
|
+
subject: ADMIN3,
|
|
11118
11198
|
query: { _program: PROGRAM, expiresAfterMins: "0" }
|
|
11119
11199
|
},
|
|
11120
11200
|
expect: { status: 400, error: '"expiresAfterMins" must be greater than 0' }
|
|
@@ -11123,14 +11203,14 @@ var SASjsApi = (() => {
|
|
|
11123
11203
|
id: "stp-trigger-missing-program",
|
|
11124
11204
|
route: "POST /SASjsApi/stp/trigger",
|
|
11125
11205
|
description: "refuses a request that names no program",
|
|
11126
|
-
request: { subject:
|
|
11206
|
+
request: { subject: ADMIN3, query: {} },
|
|
11127
11207
|
expect: { status: 400, error: '"_program" is required' }
|
|
11128
11208
|
},
|
|
11129
11209
|
{
|
|
11130
11210
|
id: "stp-trigger-failed-run",
|
|
11131
11211
|
route: "POST /SASjsApi/stp/trigger",
|
|
11132
11212
|
description: "answers 400 when the program could not be started",
|
|
11133
|
-
request: { subject:
|
|
11213
|
+
request: { subject: ADMIN3, query: { _program: PROGRAM } },
|
|
11134
11214
|
failingRun: true,
|
|
11135
11215
|
expect: { status: 400, error: FAILED }
|
|
11136
11216
|
},
|
|
@@ -11146,7 +11226,7 @@ var SASjsApi = (() => {
|
|
|
11146
11226
|
id: "code-execute-answers-output",
|
|
11147
11227
|
route: "POST /SASjsApi/code/execute",
|
|
11148
11228
|
description: "runs the code in the body and answers its output",
|
|
11149
|
-
request: { subject:
|
|
11229
|
+
request: { subject: ADMIN3, body: { code: CODE, runTime: "sas" } },
|
|
11150
11230
|
runOutput: { contents: "NOTE: mock run" },
|
|
11151
11231
|
expect: { status: 200, contents: "NOTE: mock run" }
|
|
11152
11232
|
},
|
|
@@ -11160,35 +11240,35 @@ var SASjsApi = (() => {
|
|
|
11160
11240
|
id: "code-execute-unknown-runtime",
|
|
11161
11241
|
route: "POST /SASjsApi/code/execute",
|
|
11162
11242
|
description: "refuses a run time the document does not name",
|
|
11163
|
-
request: { subject:
|
|
11243
|
+
request: { subject: ADMIN3, body: { code: CODE, runTime: "cobol" } },
|
|
11164
11244
|
expect: { status: 400 }
|
|
11165
11245
|
},
|
|
11166
11246
|
{
|
|
11167
11247
|
id: "code-execute-missing-code",
|
|
11168
11248
|
route: "POST /SASjsApi/code/execute",
|
|
11169
11249
|
description: "refuses a payload with no code",
|
|
11170
|
-
request: { subject:
|
|
11250
|
+
request: { subject: ADMIN3, body: { runTime: "sas" } },
|
|
11171
11251
|
expect: { status: 400, error: '"code" is required' }
|
|
11172
11252
|
},
|
|
11173
11253
|
{
|
|
11174
11254
|
id: "code-execute-empty-code",
|
|
11175
11255
|
route: "POST /SASjsApi/code/execute",
|
|
11176
11256
|
description: "refuses code that is present but empty",
|
|
11177
|
-
request: { subject:
|
|
11257
|
+
request: { subject: ADMIN3, body: { code: "", runTime: "sas" } },
|
|
11178
11258
|
expect: { status: 400, error: '"code" is not allowed to be empty' }
|
|
11179
11259
|
},
|
|
11180
11260
|
{
|
|
11181
11261
|
id: "code-execute-non-string-code",
|
|
11182
11262
|
route: "POST /SASjsApi/code/execute",
|
|
11183
11263
|
description: "refuses code that is not a string rather than running its text",
|
|
11184
|
-
request: { subject:
|
|
11264
|
+
request: { subject: ADMIN3, body: { code: 123, runTime: "sas" } },
|
|
11185
11265
|
expect: { status: 400, error: '"code" must be a string' }
|
|
11186
11266
|
},
|
|
11187
11267
|
{
|
|
11188
11268
|
id: "code-execute-failed-run",
|
|
11189
11269
|
route: "POST /SASjsApi/code/execute",
|
|
11190
11270
|
description: "answers 400 when the code could not be run",
|
|
11191
|
-
request: { subject:
|
|
11271
|
+
request: { subject: ADMIN3, body: { code: CODE, runTime: "sas" } },
|
|
11192
11272
|
failingRun: true,
|
|
11193
11273
|
expect: { status: 400, error: FAILED }
|
|
11194
11274
|
},
|
|
@@ -11199,19 +11279,41 @@ var SASjsApi = (() => {
|
|
|
11199
11279
|
request: { body: {} },
|
|
11200
11280
|
expect: { status: 401, error: UNAUTHORIZED2 }
|
|
11201
11281
|
},
|
|
11282
|
+
{
|
|
11283
|
+
// The fixture denies this account `/SASjsApi/code/execute` with a user rule,
|
|
11284
|
+
// and a denied rule refuses the call rather than only the menu entry beside
|
|
11285
|
+
// it. On a server that is `authorize`; here it is the decision
|
|
11286
|
+
// `myAuthorizedRoutes` reports from, asked of the same store.
|
|
11287
|
+
id: "code-execute-denied-by-a-rule",
|
|
11288
|
+
route: "POST /SASjsApi/code/execute",
|
|
11289
|
+
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" } },
|
|
11291
|
+
expect: { status: 401, error: UNAUTHORIZED2 }
|
|
11292
|
+
},
|
|
11293
|
+
{
|
|
11294
|
+
// The positive control for the case above: the same account is granted
|
|
11295
|
+
// `stp/execute` by a group rule, so the refusal there is the rule and not a
|
|
11296
|
+
// blanket refusal of everything a restricted account asks for.
|
|
11297
|
+
id: "stp-execute-granted-by-a-group-rule",
|
|
11298
|
+
route: "POST /SASjsApi/stp/execute",
|
|
11299
|
+
description: "admits a restricted account the rules grant",
|
|
11300
|
+
request: { subject: RESTRICTED3, body: { _program: PROGRAM } },
|
|
11301
|
+
runOutput: { contents: "granted run" },
|
|
11302
|
+
expect: { status: 200, contents: "granted run" }
|
|
11303
|
+
},
|
|
11202
11304
|
// ----------------------------------------------- POST /code/trigger
|
|
11203
11305
|
{
|
|
11204
11306
|
id: "code-trigger-answers-session",
|
|
11205
11307
|
route: "POST /SASjsApi/code/trigger",
|
|
11206
11308
|
description: "answers the session a caller polls, and no pid from a mock",
|
|
11207
|
-
request: { subject:
|
|
11309
|
+
request: { subject: ADMIN3, body: { code: CODE, runTime: "sas" } },
|
|
11208
11310
|
expect: { status: 200, keys: ["sessionId"] }
|
|
11209
11311
|
},
|
|
11210
11312
|
{
|
|
11211
11313
|
id: "code-trigger-missing-runtime",
|
|
11212
11314
|
route: "POST /SASjsApi/code/trigger",
|
|
11213
11315
|
description: "refuses a payload with no run time, which the document requires",
|
|
11214
|
-
request: { subject:
|
|
11316
|
+
request: { subject: ADMIN3, body: { code: CODE } },
|
|
11215
11317
|
expect: { status: 400, error: '"runTime" is required' }
|
|
11216
11318
|
},
|
|
11217
11319
|
{
|
|
@@ -11219,7 +11321,7 @@ var SASjsApi = (() => {
|
|
|
11219
11321
|
route: "POST /SASjsApi/code/trigger",
|
|
11220
11322
|
description: "refuses a retention that is not a positive number of minutes",
|
|
11221
11323
|
request: {
|
|
11222
|
-
subject:
|
|
11324
|
+
subject: ADMIN3,
|
|
11223
11325
|
body: { code: CODE, runTime: "sas", expiresAfterMins: 0 }
|
|
11224
11326
|
},
|
|
11225
11327
|
expect: { status: 400, error: '"expiresAfterMins" must be greater than 0' }
|
|
@@ -11228,7 +11330,7 @@ var SASjsApi = (() => {
|
|
|
11228
11330
|
id: "code-trigger-failed-run",
|
|
11229
11331
|
route: "POST /SASjsApi/code/trigger",
|
|
11230
11332
|
description: "answers 400 when the code could not be started",
|
|
11231
|
-
request: { subject:
|
|
11333
|
+
request: { subject: ADMIN3, body: { code: CODE, runTime: "sas" } },
|
|
11232
11334
|
failingRun: true,
|
|
11233
11335
|
expect: { status: 400, error: FAILED }
|
|
11234
11336
|
},
|
|
@@ -11303,8 +11405,8 @@ var SASjsApi = (() => {
|
|
|
11303
11405
|
}
|
|
11304
11406
|
]
|
|
11305
11407
|
};
|
|
11306
|
-
var
|
|
11307
|
-
var
|
|
11408
|
+
var ADMIN4 = "admin-access";
|
|
11409
|
+
var RESTRICTED4 = "user-access";
|
|
11308
11410
|
var RESTRICTED_UID = "user-restricted";
|
|
11309
11411
|
var ADMIN_UID = "user-admin";
|
|
11310
11412
|
var RECORD_CORPUS = [
|
|
@@ -11314,7 +11416,7 @@ var SASjsApi = (() => {
|
|
|
11314
11416
|
route: "GET /SASjsApi/user",
|
|
11315
11417
|
description: "lists the accounts any signed-in caller may see",
|
|
11316
11418
|
identity: ADMIN_SIGNED_IN,
|
|
11317
|
-
request: { token:
|
|
11419
|
+
request: { token: ADMIN4 },
|
|
11318
11420
|
expect: {
|
|
11319
11421
|
status: 200,
|
|
11320
11422
|
body: [
|
|
@@ -11338,7 +11440,7 @@ var SASjsApi = (() => {
|
|
|
11338
11440
|
route: "GET /SASjsApi/user/{uid}",
|
|
11339
11441
|
description: "returns the caller their own details, with the auto-exec code",
|
|
11340
11442
|
identity: ADMIN_SIGNED_IN,
|
|
11341
|
-
request: { token:
|
|
11443
|
+
request: { token: RESTRICTED4, params: { uid: RESTRICTED_UID } },
|
|
11342
11444
|
expect: {
|
|
11343
11445
|
status: 200,
|
|
11344
11446
|
partial: {
|
|
@@ -11363,7 +11465,7 @@ var SASjsApi = (() => {
|
|
|
11363
11465
|
route: "GET /SASjsApi/user/{uid}",
|
|
11364
11466
|
description: "answers 404 for an identifier no account has",
|
|
11365
11467
|
identity: ADMIN_SIGNED_IN,
|
|
11366
|
-
request: { token:
|
|
11468
|
+
request: { token: ADMIN4, params: { uid: "user-none" } },
|
|
11367
11469
|
expect: { status: 404, error: "User is not found." }
|
|
11368
11470
|
},
|
|
11369
11471
|
{
|
|
@@ -11371,7 +11473,7 @@ var SASjsApi = (() => {
|
|
|
11371
11473
|
route: "GET /SASjsApi/user/by/username/{username}",
|
|
11372
11474
|
description: "finds an account by username",
|
|
11373
11475
|
identity: ADMIN_SIGNED_IN,
|
|
11374
|
-
request: { token:
|
|
11476
|
+
request: { token: ADMIN4, params: { username: "sasjsuser" } },
|
|
11375
11477
|
expect: {
|
|
11376
11478
|
status: 200,
|
|
11377
11479
|
partial: { uid: RESTRICTED_UID, username: "sasjsuser", isAdmin: false }
|
|
@@ -11390,7 +11492,7 @@ var SASjsApi = (() => {
|
|
|
11390
11492
|
route: "GET /SASjsApi/user/by/username/{username}",
|
|
11391
11493
|
description: "answers 404 for a username no account has",
|
|
11392
11494
|
identity: ADMIN_SIGNED_IN,
|
|
11393
|
-
request: { token:
|
|
11495
|
+
request: { token: ADMIN4, params: { username: "nobody" } },
|
|
11394
11496
|
expect: { status: 404, error: "User is not found." }
|
|
11395
11497
|
},
|
|
11396
11498
|
{
|
|
@@ -11399,7 +11501,7 @@ var SASjsApi = (() => {
|
|
|
11399
11501
|
description: "creates an account, sanitised, and reports it",
|
|
11400
11502
|
identity: ADMIN_SIGNED_IN,
|
|
11401
11503
|
request: {
|
|
11402
|
-
token:
|
|
11504
|
+
token: ADMIN4,
|
|
11403
11505
|
body: {
|
|
11404
11506
|
username: "newuser",
|
|
11405
11507
|
displayName: " New User ",
|
|
@@ -11424,7 +11526,7 @@ var SASjsApi = (() => {
|
|
|
11424
11526
|
description: "refuses a creation by a caller who is not an administrator",
|
|
11425
11527
|
identity: ADMIN_SIGNED_IN,
|
|
11426
11528
|
request: {
|
|
11427
|
-
token:
|
|
11529
|
+
token: RESTRICTED4,
|
|
11428
11530
|
body: {
|
|
11429
11531
|
username: "newuser",
|
|
11430
11532
|
displayName: "New User",
|
|
@@ -11447,7 +11549,7 @@ var SASjsApi = (() => {
|
|
|
11447
11549
|
description: "refuses a username that is taken",
|
|
11448
11550
|
identity: ADMIN_SIGNED_IN,
|
|
11449
11551
|
request: {
|
|
11450
|
-
token:
|
|
11552
|
+
token: ADMIN4,
|
|
11451
11553
|
body: {
|
|
11452
11554
|
username: "sasjsuser",
|
|
11453
11555
|
displayName: "Another",
|
|
@@ -11462,7 +11564,7 @@ var SASjsApi = (() => {
|
|
|
11462
11564
|
description: "changes an account's display name",
|
|
11463
11565
|
identity: ADMIN_SIGNED_IN,
|
|
11464
11566
|
request: {
|
|
11465
|
-
token:
|
|
11567
|
+
token: ADMIN4,
|
|
11466
11568
|
params: { uid: RESTRICTED_UID },
|
|
11467
11569
|
body: {
|
|
11468
11570
|
displayName: "Renamed User",
|
|
@@ -11481,7 +11583,7 @@ var SASjsApi = (() => {
|
|
|
11481
11583
|
description: "refuses a change to somebody else's account",
|
|
11482
11584
|
identity: ADMIN_SIGNED_IN,
|
|
11483
11585
|
request: {
|
|
11484
|
-
token:
|
|
11586
|
+
token: RESTRICTED4,
|
|
11485
11587
|
params: { uid: ADMIN_UID },
|
|
11486
11588
|
body: {
|
|
11487
11589
|
displayName: "Hijacked",
|
|
@@ -11497,7 +11599,7 @@ var SASjsApi = (() => {
|
|
|
11497
11599
|
description: "answers 404 with the identifier it looked up",
|
|
11498
11600
|
identity: ADMIN_SIGNED_IN,
|
|
11499
11601
|
request: {
|
|
11500
|
-
token:
|
|
11602
|
+
token: ADMIN4,
|
|
11501
11603
|
params: { uid: "user-none" },
|
|
11502
11604
|
body: { displayName: "Nobody", username: "nobody", password: "none123" }
|
|
11503
11605
|
},
|
|
@@ -11509,7 +11611,7 @@ var SASjsApi = (() => {
|
|
|
11509
11611
|
description: "refuses a username change on a provider-managed account",
|
|
11510
11612
|
identity: PROVIDER_MANAGED,
|
|
11511
11613
|
request: {
|
|
11512
|
-
token:
|
|
11614
|
+
token: ADMIN4,
|
|
11513
11615
|
params: { uid: "user-directory" },
|
|
11514
11616
|
body: {
|
|
11515
11617
|
username: "renamed",
|
|
@@ -11528,7 +11630,7 @@ var SASjsApi = (() => {
|
|
|
11528
11630
|
description: "refuses a username another account already has",
|
|
11529
11631
|
identity: ADMIN_SIGNED_IN,
|
|
11530
11632
|
request: {
|
|
11531
|
-
token:
|
|
11633
|
+
token: ADMIN4,
|
|
11532
11634
|
params: { uid: RESTRICTED_UID },
|
|
11533
11635
|
body: {
|
|
11534
11636
|
username: "sasjsadmin",
|
|
@@ -11544,7 +11646,7 @@ var SASjsApi = (() => {
|
|
|
11544
11646
|
description: "changes an account looked up by username",
|
|
11545
11647
|
identity: ADMIN_SIGNED_IN,
|
|
11546
11648
|
request: {
|
|
11547
|
-
token:
|
|
11649
|
+
token: ADMIN4,
|
|
11548
11650
|
params: { username: "sasjsuser" },
|
|
11549
11651
|
body: {
|
|
11550
11652
|
isActive: false,
|
|
@@ -11561,7 +11663,7 @@ var SASjsApi = (() => {
|
|
|
11561
11663
|
description: "refuses a change to another account by username",
|
|
11562
11664
|
identity: ADMIN_SIGNED_IN,
|
|
11563
11665
|
request: {
|
|
11564
|
-
token:
|
|
11666
|
+
token: RESTRICTED4,
|
|
11565
11667
|
params: { username: "sasjsadmin" },
|
|
11566
11668
|
body: {
|
|
11567
11669
|
displayName: "Hijacked",
|
|
@@ -11577,7 +11679,7 @@ var SASjsApi = (() => {
|
|
|
11577
11679
|
description: "answers 404 with the username it looked up",
|
|
11578
11680
|
identity: ADMIN_SIGNED_IN,
|
|
11579
11681
|
request: {
|
|
11580
|
-
token:
|
|
11682
|
+
token: ADMIN4,
|
|
11581
11683
|
params: { username: "nobody" },
|
|
11582
11684
|
body: { displayName: "Nobody", username: "nobody", password: "none123" }
|
|
11583
11685
|
},
|
|
@@ -11589,7 +11691,7 @@ var SASjsApi = (() => {
|
|
|
11589
11691
|
description: "refuses a display-name change on a provider-managed account",
|
|
11590
11692
|
identity: PROVIDER_MANAGED,
|
|
11591
11693
|
request: {
|
|
11592
|
-
token:
|
|
11694
|
+
token: ADMIN4,
|
|
11593
11695
|
params: { username: "diruser" },
|
|
11594
11696
|
body: { displayName: "Renamed", username: "diruser", password: "dir123" }
|
|
11595
11697
|
},
|
|
@@ -11604,7 +11706,7 @@ var SASjsApi = (() => {
|
|
|
11604
11706
|
description: "refuses a username another account already has",
|
|
11605
11707
|
identity: ADMIN_SIGNED_IN,
|
|
11606
11708
|
request: {
|
|
11607
|
-
token:
|
|
11709
|
+
token: ADMIN4,
|
|
11608
11710
|
params: { username: "sasjsuser" },
|
|
11609
11711
|
body: {
|
|
11610
11712
|
username: "sasjsadmin",
|
|
@@ -11619,7 +11721,7 @@ var SASjsApi = (() => {
|
|
|
11619
11721
|
route: "DELETE /SASjsApi/user/{uid}",
|
|
11620
11722
|
description: "deletes an account as an administrator, without a password",
|
|
11621
11723
|
identity: ADMIN_SIGNED_IN,
|
|
11622
|
-
request: { token:
|
|
11724
|
+
request: { token: ADMIN4, params: { uid: RESTRICTED_UID }, body: {} },
|
|
11623
11725
|
expect: { status: 200, body: "Account Deleted!" }
|
|
11624
11726
|
},
|
|
11625
11727
|
{
|
|
@@ -11627,7 +11729,7 @@ var SASjsApi = (() => {
|
|
|
11627
11729
|
route: "DELETE /SASjsApi/user/{uid}",
|
|
11628
11730
|
description: "refuses a deletion of somebody else's account",
|
|
11629
11731
|
identity: ADMIN_SIGNED_IN,
|
|
11630
|
-
request: { token:
|
|
11732
|
+
request: { token: RESTRICTED4, params: { uid: ADMIN_UID }, body: {} },
|
|
11631
11733
|
expect: { status: 401, error: "Admin account required" }
|
|
11632
11734
|
},
|
|
11633
11735
|
{
|
|
@@ -11635,7 +11737,7 @@ var SASjsApi = (() => {
|
|
|
11635
11737
|
route: "DELETE /SASjsApi/user/{uid}",
|
|
11636
11738
|
description: "answers 404 for an identifier no account has",
|
|
11637
11739
|
identity: ADMIN_SIGNED_IN,
|
|
11638
|
-
request: { token:
|
|
11740
|
+
request: { token: ADMIN4, params: { uid: "user-none" }, body: {} },
|
|
11639
11741
|
expect: { status: 404, error: "User is not found." }
|
|
11640
11742
|
},
|
|
11641
11743
|
{
|
|
@@ -11644,7 +11746,7 @@ var SASjsApi = (() => {
|
|
|
11644
11746
|
description: "deletes an account looked up by username",
|
|
11645
11747
|
identity: ADMIN_SIGNED_IN,
|
|
11646
11748
|
request: {
|
|
11647
|
-
token:
|
|
11749
|
+
token: ADMIN4,
|
|
11648
11750
|
params: { username: "sasjsuser" },
|
|
11649
11751
|
body: {}
|
|
11650
11752
|
},
|
|
@@ -11656,7 +11758,7 @@ var SASjsApi = (() => {
|
|
|
11656
11758
|
description: "refuses a self-deletion whose password is wrong",
|
|
11657
11759
|
identity: ADMIN_SIGNED_IN,
|
|
11658
11760
|
request: {
|
|
11659
|
-
token:
|
|
11761
|
+
token: RESTRICTED4,
|
|
11660
11762
|
params: { username: "sasjsuser" },
|
|
11661
11763
|
body: { password: "wrong123" }
|
|
11662
11764
|
},
|
|
@@ -11667,7 +11769,7 @@ var SASjsApi = (() => {
|
|
|
11667
11769
|
route: "DELETE /SASjsApi/user/by/username/{username}",
|
|
11668
11770
|
description: "answers 404 for a username no account has",
|
|
11669
11771
|
identity: ADMIN_SIGNED_IN,
|
|
11670
|
-
request: { token:
|
|
11772
|
+
request: { token: ADMIN4, params: { username: "nobody" }, body: {} },
|
|
11671
11773
|
expect: { status: 404, error: "User is not found." }
|
|
11672
11774
|
},
|
|
11673
11775
|
// ----------------------------------------------------------------- groups
|
|
@@ -11676,7 +11778,7 @@ var SASjsApi = (() => {
|
|
|
11676
11778
|
route: "GET /SASjsApi/group",
|
|
11677
11779
|
description: "lists the groups",
|
|
11678
11780
|
identity: ADMIN_SIGNED_IN,
|
|
11679
|
-
request: { token:
|
|
11781
|
+
request: { token: RESTRICTED4 },
|
|
11680
11782
|
expect: {
|
|
11681
11783
|
status: 200,
|
|
11682
11784
|
body: [
|
|
@@ -11698,7 +11800,7 @@ var SASjsApi = (() => {
|
|
|
11698
11800
|
route: "GET /SASjsApi/group/{uid}",
|
|
11699
11801
|
description: "returns a group and its members",
|
|
11700
11802
|
identity: ADMIN_SIGNED_IN,
|
|
11701
|
-
request: { token:
|
|
11803
|
+
request: { token: RESTRICTED4, params: { uid: "group-admins" } },
|
|
11702
11804
|
expect: {
|
|
11703
11805
|
status: 200,
|
|
11704
11806
|
partial: {
|
|
@@ -11721,7 +11823,7 @@ var SASjsApi = (() => {
|
|
|
11721
11823
|
route: "GET /SASjsApi/group/{uid}",
|
|
11722
11824
|
description: "answers 404 for an identifier no group has",
|
|
11723
11825
|
identity: ADMIN_SIGNED_IN,
|
|
11724
|
-
request: { token:
|
|
11826
|
+
request: { token: ADMIN4, params: { uid: "group-none" } },
|
|
11725
11827
|
expect: { status: 404, error: "Group not found." }
|
|
11726
11828
|
},
|
|
11727
11829
|
{
|
|
@@ -11729,7 +11831,7 @@ var SASjsApi = (() => {
|
|
|
11729
11831
|
route: "GET /SASjsApi/group/by/groupname/{name}",
|
|
11730
11832
|
description: "finds a group by name",
|
|
11731
11833
|
identity: ADMIN_SIGNED_IN,
|
|
11732
|
-
request: { token:
|
|
11834
|
+
request: { token: ADMIN4, params: { name: "DCGroup" } },
|
|
11733
11835
|
expect: {
|
|
11734
11836
|
status: 200,
|
|
11735
11837
|
partial: { uid: "group-data-controller", name: "DCGroup" }
|
|
@@ -11740,7 +11842,7 @@ var SASjsApi = (() => {
|
|
|
11740
11842
|
route: "GET /SASjsApi/group/by/groupname/{name}",
|
|
11741
11843
|
description: "answers 404 for a name no group has",
|
|
11742
11844
|
identity: ADMIN_SIGNED_IN,
|
|
11743
|
-
request: { token:
|
|
11845
|
+
request: { token: ADMIN4, params: { name: "nope" } },
|
|
11744
11846
|
expect: { status: 404, error: "Group not found." }
|
|
11745
11847
|
},
|
|
11746
11848
|
{
|
|
@@ -11749,7 +11851,7 @@ var SASjsApi = (() => {
|
|
|
11749
11851
|
description: "creates a group with no members",
|
|
11750
11852
|
identity: ADMIN_SIGNED_IN,
|
|
11751
11853
|
request: {
|
|
11752
|
-
token:
|
|
11854
|
+
token: ADMIN4,
|
|
11753
11855
|
body: { name: "NewGroup", description: "A new group", isActive: true }
|
|
11754
11856
|
},
|
|
11755
11857
|
expect: {
|
|
@@ -11768,7 +11870,7 @@ var SASjsApi = (() => {
|
|
|
11768
11870
|
description: "refuses a creation by a caller who is not an administrator",
|
|
11769
11871
|
identity: ADMIN_SIGNED_IN,
|
|
11770
11872
|
request: {
|
|
11771
|
-
token:
|
|
11873
|
+
token: RESTRICTED4,
|
|
11772
11874
|
body: { name: "NewGroup", description: "x" }
|
|
11773
11875
|
},
|
|
11774
11876
|
expect: { status: 401, error: "Admin account required" }
|
|
@@ -11778,7 +11880,7 @@ var SASjsApi = (() => {
|
|
|
11778
11880
|
route: "POST /SASjsApi/group",
|
|
11779
11881
|
description: "refuses a name that is taken",
|
|
11780
11882
|
identity: ADMIN_SIGNED_IN,
|
|
11781
|
-
request: { token:
|
|
11883
|
+
request: { token: ADMIN4, body: { name: "DCGroup", description: "again" } },
|
|
11782
11884
|
expect: { status: 409, error: "Group name already exists." }
|
|
11783
11885
|
},
|
|
11784
11886
|
{
|
|
@@ -11787,7 +11889,7 @@ var SASjsApi = (() => {
|
|
|
11787
11889
|
description: "adds a member and returns the group",
|
|
11788
11890
|
identity: ADMIN_SIGNED_IN,
|
|
11789
11891
|
request: {
|
|
11790
|
-
token:
|
|
11892
|
+
token: ADMIN4,
|
|
11791
11893
|
params: { groupUid: "group-admins", userUid: RESTRICTED_UID }
|
|
11792
11894
|
},
|
|
11793
11895
|
expect: {
|
|
@@ -11801,7 +11903,7 @@ var SASjsApi = (() => {
|
|
|
11801
11903
|
description: "refuses a change to the reserved public group",
|
|
11802
11904
|
identity: PROVIDER_MANAGED,
|
|
11803
11905
|
request: {
|
|
11804
|
-
token:
|
|
11906
|
+
token: ADMIN4,
|
|
11805
11907
|
params: { groupUid: "group-public", userUid: RESTRICTED_UID }
|
|
11806
11908
|
},
|
|
11807
11909
|
expect: { status: 400, error: "Can't add/remove user to 'public' group." }
|
|
@@ -11812,7 +11914,7 @@ var SASjsApi = (() => {
|
|
|
11812
11914
|
description: "refuses a membership change by a non-administrator",
|
|
11813
11915
|
identity: ADMIN_SIGNED_IN,
|
|
11814
11916
|
request: {
|
|
11815
|
-
token:
|
|
11917
|
+
token: RESTRICTED4,
|
|
11816
11918
|
params: { groupUid: "group-admins", userUid: RESTRICTED_UID }
|
|
11817
11919
|
},
|
|
11818
11920
|
expect: { status: 401, error: "Admin account required" }
|
|
@@ -11823,7 +11925,7 @@ var SASjsApi = (() => {
|
|
|
11823
11925
|
description: "answers 404 for a group that does not exist",
|
|
11824
11926
|
identity: ADMIN_SIGNED_IN,
|
|
11825
11927
|
request: {
|
|
11826
|
-
token:
|
|
11928
|
+
token: ADMIN4,
|
|
11827
11929
|
params: { groupUid: "group-none", userUid: RESTRICTED_UID }
|
|
11828
11930
|
},
|
|
11829
11931
|
expect: { status: 404, error: "Group not found." }
|
|
@@ -11834,7 +11936,7 @@ var SASjsApi = (() => {
|
|
|
11834
11936
|
description: "refuses a membership change on a provider-managed group",
|
|
11835
11937
|
identity: PROVIDER_MANAGED,
|
|
11836
11938
|
request: {
|
|
11837
|
-
token:
|
|
11939
|
+
token: ADMIN4,
|
|
11838
11940
|
params: { groupUid: "group-directory", userUid: RESTRICTED_UID }
|
|
11839
11941
|
},
|
|
11840
11942
|
expect: {
|
|
@@ -11848,7 +11950,7 @@ var SASjsApi = (() => {
|
|
|
11848
11950
|
description: "removes a member and returns the group",
|
|
11849
11951
|
identity: ADMIN_SIGNED_IN,
|
|
11850
11952
|
request: {
|
|
11851
|
-
token:
|
|
11953
|
+
token: ADMIN4,
|
|
11852
11954
|
params: { groupUid: "group-data-controller", userUid: RESTRICTED_UID }
|
|
11853
11955
|
},
|
|
11854
11956
|
expect: {
|
|
@@ -11862,7 +11964,7 @@ var SASjsApi = (() => {
|
|
|
11862
11964
|
description: "refuses a membership change for a provider-managed user",
|
|
11863
11965
|
identity: PROVIDER_MANAGED,
|
|
11864
11966
|
request: {
|
|
11865
|
-
token:
|
|
11967
|
+
token: ADMIN4,
|
|
11866
11968
|
params: { groupUid: "group-admins", userUid: "user-directory" }
|
|
11867
11969
|
},
|
|
11868
11970
|
expect: {
|
|
@@ -11876,7 +11978,7 @@ var SASjsApi = (() => {
|
|
|
11876
11978
|
description: "refuses a membership change for a provider-managed user",
|
|
11877
11979
|
identity: PROVIDER_MANAGED,
|
|
11878
11980
|
request: {
|
|
11879
|
-
token:
|
|
11981
|
+
token: ADMIN4,
|
|
11880
11982
|
params: { groupUid: "group-admins", userUid: "user-directory" }
|
|
11881
11983
|
},
|
|
11882
11984
|
expect: {
|
|
@@ -11890,7 +11992,7 @@ var SASjsApi = (() => {
|
|
|
11890
11992
|
description: "refuses a change to the reserved public group",
|
|
11891
11993
|
identity: PROVIDER_MANAGED,
|
|
11892
11994
|
request: {
|
|
11893
|
-
token:
|
|
11995
|
+
token: ADMIN4,
|
|
11894
11996
|
params: { groupUid: "group-public", userUid: RESTRICTED_UID }
|
|
11895
11997
|
},
|
|
11896
11998
|
expect: { status: 400, error: "Can't add/remove user to 'public' group." }
|
|
@@ -11901,7 +12003,7 @@ var SASjsApi = (() => {
|
|
|
11901
12003
|
description: "refuses a membership change by a non-administrator",
|
|
11902
12004
|
identity: ADMIN_SIGNED_IN,
|
|
11903
12005
|
request: {
|
|
11904
|
-
token:
|
|
12006
|
+
token: RESTRICTED4,
|
|
11905
12007
|
params: { groupUid: "group-data-controller", userUid: RESTRICTED_UID }
|
|
11906
12008
|
},
|
|
11907
12009
|
expect: { status: 401, error: "Admin account required" }
|
|
@@ -11912,7 +12014,7 @@ var SASjsApi = (() => {
|
|
|
11912
12014
|
description: "answers 404 for a member that does not exist",
|
|
11913
12015
|
identity: ADMIN_SIGNED_IN,
|
|
11914
12016
|
request: {
|
|
11915
|
-
token:
|
|
12017
|
+
token: ADMIN4,
|
|
11916
12018
|
params: { groupUid: "group-admins", userUid: "user-none" }
|
|
11917
12019
|
},
|
|
11918
12020
|
expect: { status: 404, error: "User not found." }
|
|
@@ -11923,7 +12025,7 @@ var SASjsApi = (() => {
|
|
|
11923
12025
|
description: "refuses a membership change on a provider-managed group",
|
|
11924
12026
|
identity: PROVIDER_MANAGED,
|
|
11925
12027
|
request: {
|
|
11926
|
-
token:
|
|
12028
|
+
token: ADMIN4,
|
|
11927
12029
|
params: { groupUid: "group-directory", userUid: RESTRICTED_UID }
|
|
11928
12030
|
},
|
|
11929
12031
|
expect: {
|
|
@@ -11936,7 +12038,7 @@ var SASjsApi = (() => {
|
|
|
11936
12038
|
route: "DELETE /SASjsApi/group/{uid}",
|
|
11937
12039
|
description: "deletes a group",
|
|
11938
12040
|
identity: ADMIN_SIGNED_IN,
|
|
11939
|
-
request: { token:
|
|
12041
|
+
request: { token: ADMIN4, params: { uid: "group-data-controller" } },
|
|
11940
12042
|
expect: { status: 200 }
|
|
11941
12043
|
},
|
|
11942
12044
|
{
|
|
@@ -11944,7 +12046,7 @@ var SASjsApi = (() => {
|
|
|
11944
12046
|
route: "DELETE /SASjsApi/group/{uid}",
|
|
11945
12047
|
description: "refuses a deletion by a caller who is not an administrator",
|
|
11946
12048
|
identity: ADMIN_SIGNED_IN,
|
|
11947
|
-
request: { token:
|
|
12049
|
+
request: { token: RESTRICTED4, params: { uid: "group-admins" } },
|
|
11948
12050
|
expect: { status: 401, error: "Admin account required" }
|
|
11949
12051
|
},
|
|
11950
12052
|
{
|
|
@@ -11952,7 +12054,7 @@ var SASjsApi = (() => {
|
|
|
11952
12054
|
route: "DELETE /SASjsApi/group/{uid}",
|
|
11953
12055
|
description: "answers 404 for an identifier no group has",
|
|
11954
12056
|
identity: ADMIN_SIGNED_IN,
|
|
11955
|
-
request: { token:
|
|
12057
|
+
request: { token: ADMIN4, params: { uid: "group-none" } },
|
|
11956
12058
|
expect: { status: 404, error: "Group not found." }
|
|
11957
12059
|
},
|
|
11958
12060
|
// ------------------------------------------------------------ permissions
|
|
@@ -11961,7 +12063,7 @@ var SASjsApi = (() => {
|
|
|
11961
12063
|
route: "GET /SASjsApi/info/authorizedRoutes",
|
|
11962
12064
|
description: "answers the route inventory to an administrator",
|
|
11963
12065
|
identity: ADMIN_SIGNED_IN,
|
|
11964
|
-
request: { token:
|
|
12066
|
+
request: { token: ADMIN4 },
|
|
11965
12067
|
expect: {
|
|
11966
12068
|
status: 200,
|
|
11967
12069
|
body: {
|
|
@@ -11985,7 +12087,7 @@ var SASjsApi = (() => {
|
|
|
11985
12087
|
route: "GET /SASjsApi/info/authorizedRoutes",
|
|
11986
12088
|
description: "refuses the inventory to a caller who is not an administrator",
|
|
11987
12089
|
identity: ADMIN_SIGNED_IN,
|
|
11988
|
-
request: { token:
|
|
12090
|
+
request: { token: RESTRICTED4 },
|
|
11989
12091
|
expect: { status: 401, error: "Admin account required" }
|
|
11990
12092
|
},
|
|
11991
12093
|
{
|
|
@@ -11993,7 +12095,7 @@ var SASjsApi = (() => {
|
|
|
11993
12095
|
route: "GET /SASjsApi/info/myAuthorizedRoutes",
|
|
11994
12096
|
description: "answers every route to an administrator",
|
|
11995
12097
|
identity: ADMIN_SIGNED_IN,
|
|
11996
|
-
request: { token:
|
|
12098
|
+
request: { token: ADMIN4 },
|
|
11997
12099
|
expect: {
|
|
11998
12100
|
status: 200,
|
|
11999
12101
|
body: {
|
|
@@ -12017,7 +12119,7 @@ var SASjsApi = (() => {
|
|
|
12017
12119
|
route: "GET /SASjsApi/info/myAuthorizedRoutes",
|
|
12018
12120
|
description: "answers a caller only the routes its rules grant",
|
|
12019
12121
|
identity: ADMIN_SIGNED_IN,
|
|
12020
|
-
request: { token:
|
|
12122
|
+
request: { token: RESTRICTED4 },
|
|
12021
12123
|
expect: {
|
|
12022
12124
|
status: 200,
|
|
12023
12125
|
// /AppStream is visible whatever the rules say; the two grants come from
|
|
@@ -12033,7 +12135,7 @@ var SASjsApi = (() => {
|
|
|
12033
12135
|
route: "GET /SASjsApi/permission",
|
|
12034
12136
|
description: "returns every rule to an administrator",
|
|
12035
12137
|
identity: ADMIN_SIGNED_IN,
|
|
12036
|
-
request: { token:
|
|
12138
|
+
request: { token: ADMIN4 },
|
|
12037
12139
|
expect: {
|
|
12038
12140
|
status: 200,
|
|
12039
12141
|
body: [
|
|
@@ -12066,7 +12168,7 @@ var SASjsApi = (() => {
|
|
|
12066
12168
|
route: "GET /SASjsApi/permission",
|
|
12067
12169
|
description: "returns a caller only their own rules and their groups'",
|
|
12068
12170
|
identity: ADMIN_SIGNED_IN,
|
|
12069
|
-
request: { token:
|
|
12171
|
+
request: { token: RESTRICTED4 },
|
|
12070
12172
|
expect: {
|
|
12071
12173
|
status: 200,
|
|
12072
12174
|
body: [
|
|
@@ -12108,7 +12210,7 @@ var SASjsApi = (() => {
|
|
|
12108
12210
|
description: "creates a rule for a user",
|
|
12109
12211
|
identity: ADMIN_SIGNED_IN,
|
|
12110
12212
|
request: {
|
|
12111
|
-
token:
|
|
12213
|
+
token: ADMIN4,
|
|
12112
12214
|
body: {
|
|
12113
12215
|
path: "/SASjsApi/drive/folder",
|
|
12114
12216
|
type: "Route",
|
|
@@ -12128,7 +12230,7 @@ var SASjsApi = (() => {
|
|
|
12128
12230
|
description: "creates a rule for a group",
|
|
12129
12231
|
identity: ADMIN_SIGNED_IN,
|
|
12130
12232
|
request: {
|
|
12131
|
-
token:
|
|
12233
|
+
token: ADMIN4,
|
|
12132
12234
|
body: {
|
|
12133
12235
|
path: "/SASjsApi/drive/rename",
|
|
12134
12236
|
type: "Route",
|
|
@@ -12152,7 +12254,7 @@ var SASjsApi = (() => {
|
|
|
12152
12254
|
description: "refuses a principal type that is neither a user nor a group",
|
|
12153
12255
|
identity: ADMIN_SIGNED_IN,
|
|
12154
12256
|
request: {
|
|
12155
|
-
token:
|
|
12257
|
+
token: ADMIN4,
|
|
12156
12258
|
body: {
|
|
12157
12259
|
path: "/SASjsApi/drive/deploy",
|
|
12158
12260
|
type: "Route",
|
|
@@ -12172,7 +12274,7 @@ var SASjsApi = (() => {
|
|
|
12172
12274
|
description: "refuses a rule assigned to an administrator",
|
|
12173
12275
|
identity: ADMIN_SIGNED_IN,
|
|
12174
12276
|
request: {
|
|
12175
|
-
token:
|
|
12277
|
+
token: ADMIN4,
|
|
12176
12278
|
body: {
|
|
12177
12279
|
path: "/SASjsApi/drive/folder",
|
|
12178
12280
|
type: "Route",
|
|
@@ -12192,7 +12294,7 @@ var SASjsApi = (() => {
|
|
|
12192
12294
|
description: "refuses a creation by a non-administrator",
|
|
12193
12295
|
identity: ADMIN_SIGNED_IN,
|
|
12194
12296
|
request: {
|
|
12195
|
-
token:
|
|
12297
|
+
token: RESTRICTED4,
|
|
12196
12298
|
body: {
|
|
12197
12299
|
path: "/SASjsApi/drive/folder",
|
|
12198
12300
|
type: "Route",
|
|
@@ -12209,7 +12311,7 @@ var SASjsApi = (() => {
|
|
|
12209
12311
|
description: "answers 404 for a principal that does not exist",
|
|
12210
12312
|
identity: ADMIN_SIGNED_IN,
|
|
12211
12313
|
request: {
|
|
12212
|
-
token:
|
|
12314
|
+
token: ADMIN4,
|
|
12213
12315
|
body: {
|
|
12214
12316
|
path: "/SASjsApi/drive/rename",
|
|
12215
12317
|
type: "Route",
|
|
@@ -12226,7 +12328,7 @@ var SASjsApi = (() => {
|
|
|
12226
12328
|
description: "refuses a group rule that already exists",
|
|
12227
12329
|
identity: ADMIN_SIGNED_IN,
|
|
12228
12330
|
request: {
|
|
12229
|
-
token:
|
|
12331
|
+
token: ADMIN4,
|
|
12230
12332
|
body: {
|
|
12231
12333
|
path: "/SASjsApi/drive/file",
|
|
12232
12334
|
type: "Route",
|
|
@@ -12246,7 +12348,7 @@ var SASjsApi = (() => {
|
|
|
12246
12348
|
description: "refuses a rule that already exists",
|
|
12247
12349
|
identity: ADMIN_SIGNED_IN,
|
|
12248
12350
|
request: {
|
|
12249
|
-
token:
|
|
12351
|
+
token: ADMIN4,
|
|
12250
12352
|
body: {
|
|
12251
12353
|
path: "/SASjsApi/code/execute",
|
|
12252
12354
|
type: "Route",
|
|
@@ -12266,7 +12368,7 @@ var SASjsApi = (() => {
|
|
|
12266
12368
|
description: "flips a rule from Deny to Grant",
|
|
12267
12369
|
identity: ADMIN_SIGNED_IN,
|
|
12268
12370
|
request: {
|
|
12269
|
-
token:
|
|
12371
|
+
token: ADMIN4,
|
|
12270
12372
|
params: { uid: "rule-code" },
|
|
12271
12373
|
body: { setting: "Grant" }
|
|
12272
12374
|
},
|
|
@@ -12278,7 +12380,7 @@ var SASjsApi = (() => {
|
|
|
12278
12380
|
description: "refuses a change by a non-administrator",
|
|
12279
12381
|
identity: ADMIN_SIGNED_IN,
|
|
12280
12382
|
request: {
|
|
12281
|
-
token:
|
|
12383
|
+
token: RESTRICTED4,
|
|
12282
12384
|
params: { uid: "rule-code" },
|
|
12283
12385
|
body: { setting: "Grant" }
|
|
12284
12386
|
},
|
|
@@ -12290,7 +12392,7 @@ var SASjsApi = (() => {
|
|
|
12290
12392
|
description: "answers 404 for a rule that does not exist",
|
|
12291
12393
|
identity: ADMIN_SIGNED_IN,
|
|
12292
12394
|
request: {
|
|
12293
|
-
token:
|
|
12395
|
+
token: ADMIN4,
|
|
12294
12396
|
params: { uid: "rule-none" },
|
|
12295
12397
|
body: { setting: "Grant" }
|
|
12296
12398
|
},
|
|
@@ -12301,7 +12403,7 @@ var SASjsApi = (() => {
|
|
|
12301
12403
|
route: "DELETE /SASjsApi/permission/{uid}",
|
|
12302
12404
|
description: "deletes a rule",
|
|
12303
12405
|
identity: ADMIN_SIGNED_IN,
|
|
12304
|
-
request: { token:
|
|
12406
|
+
request: { token: ADMIN4, params: { uid: "rule-code" } },
|
|
12305
12407
|
expect: { status: 200, body: "Permission Deleted!" }
|
|
12306
12408
|
},
|
|
12307
12409
|
{
|
|
@@ -12309,7 +12411,7 @@ var SASjsApi = (() => {
|
|
|
12309
12411
|
route: "DELETE /SASjsApi/permission/{uid}",
|
|
12310
12412
|
description: "refuses a deletion by a non-administrator",
|
|
12311
12413
|
identity: ADMIN_SIGNED_IN,
|
|
12312
|
-
request: { token:
|
|
12414
|
+
request: { token: RESTRICTED4, params: { uid: "rule-code" } },
|
|
12313
12415
|
expect: { status: 401, error: "Admin account required" }
|
|
12314
12416
|
},
|
|
12315
12417
|
{
|
|
@@ -12317,7 +12419,7 @@ var SASjsApi = (() => {
|
|
|
12317
12419
|
route: "DELETE /SASjsApi/permission/{uid}",
|
|
12318
12420
|
description: "answers 404 for a rule that does not exist",
|
|
12319
12421
|
identity: ADMIN_SIGNED_IN,
|
|
12320
|
-
request: { token:
|
|
12422
|
+
request: { token: ADMIN4, params: { uid: "rule-none" } },
|
|
12321
12423
|
expect: { status: 404, error: "Permission not found." }
|
|
12322
12424
|
},
|
|
12323
12425
|
// --------------------------------------------------------------- clients
|
|
@@ -12326,7 +12428,7 @@ var SASjsApi = (() => {
|
|
|
12326
12428
|
route: "GET /SASjsApi/client",
|
|
12327
12429
|
description: "lists the registered clients",
|
|
12328
12430
|
identity: ADMIN_SIGNED_IN,
|
|
12329
|
-
request: { token:
|
|
12431
|
+
request: { token: ADMIN4 },
|
|
12330
12432
|
expect: {
|
|
12331
12433
|
status: 200,
|
|
12332
12434
|
body: [
|
|
@@ -12350,7 +12452,7 @@ var SASjsApi = (() => {
|
|
|
12350
12452
|
route: "GET /SASjsApi/client",
|
|
12351
12453
|
description: "refuses the list to a caller who is not an administrator",
|
|
12352
12454
|
identity: ADMIN_SIGNED_IN,
|
|
12353
|
-
request: { token:
|
|
12455
|
+
request: { token: RESTRICTED4 },
|
|
12354
12456
|
expect: { status: 401, error: "Admin account required" }
|
|
12355
12457
|
},
|
|
12356
12458
|
{
|
|
@@ -12359,7 +12461,7 @@ var SASjsApi = (() => {
|
|
|
12359
12461
|
description: "registers a client",
|
|
12360
12462
|
identity: ADMIN_SIGNED_IN,
|
|
12361
12463
|
request: {
|
|
12362
|
-
token:
|
|
12464
|
+
token: ADMIN4,
|
|
12363
12465
|
body: {
|
|
12364
12466
|
clientId: "new_app",
|
|
12365
12467
|
clientSecret: "new_secret",
|
|
@@ -12383,7 +12485,7 @@ var SASjsApi = (() => {
|
|
|
12383
12485
|
description: "applies the schema defaults when the lifetimes are omitted",
|
|
12384
12486
|
identity: ADMIN_SIGNED_IN,
|
|
12385
12487
|
request: {
|
|
12386
|
-
token:
|
|
12488
|
+
token: ADMIN4,
|
|
12387
12489
|
body: { clientId: "default_app", clientSecret: "default_secret" }
|
|
12388
12490
|
},
|
|
12389
12491
|
expect: {
|
|
@@ -12402,7 +12504,7 @@ var SASjsApi = (() => {
|
|
|
12402
12504
|
description: "refuses a registration by a non-administrator",
|
|
12403
12505
|
identity: ADMIN_SIGNED_IN,
|
|
12404
12506
|
request: {
|
|
12405
|
-
token:
|
|
12507
|
+
token: RESTRICTED4,
|
|
12406
12508
|
body: {
|
|
12407
12509
|
clientId: "new_app",
|
|
12408
12510
|
clientSecret: "new_secret",
|
|
@@ -12418,7 +12520,7 @@ var SASjsApi = (() => {
|
|
|
12418
12520
|
description: "refuses a client id that is registered, with the 403 the server sends",
|
|
12419
12521
|
identity: ADMIN_SIGNED_IN,
|
|
12420
12522
|
request: {
|
|
12421
|
-
token:
|
|
12523
|
+
token: ADMIN4,
|
|
12422
12524
|
body: {
|
|
12423
12525
|
clientId: "web_app",
|
|
12424
12526
|
clientSecret: "other",
|
|
@@ -12435,7 +12537,7 @@ var SASjsApi = (() => {
|
|
|
12435
12537
|
description: "changes the caller’s own password",
|
|
12436
12538
|
identity: ADMIN_SIGNED_IN,
|
|
12437
12539
|
request: {
|
|
12438
|
-
token:
|
|
12540
|
+
token: RESTRICTED4,
|
|
12439
12541
|
body: { currentPassword: "Orion123", newPassword: "changed123" }
|
|
12440
12542
|
},
|
|
12441
12543
|
expect: { status: 204 }
|
|
@@ -12445,7 +12547,7 @@ var SASjsApi = (() => {
|
|
|
12445
12547
|
route: "PATCH /SASjsApi/auth/updatePassword",
|
|
12446
12548
|
description: "refuses a body without the current password",
|
|
12447
12549
|
identity: ADMIN_SIGNED_IN,
|
|
12448
|
-
request: { token:
|
|
12550
|
+
request: { token: RESTRICTED4, body: { newPassword: "changed123" } },
|
|
12449
12551
|
expect: { status: 400, error: '"currentPassword" is required' }
|
|
12450
12552
|
},
|
|
12451
12553
|
{
|
|
@@ -12464,7 +12566,7 @@ var SASjsApi = (() => {
|
|
|
12464
12566
|
description: "refuses a change whose current password is wrong",
|
|
12465
12567
|
identity: ADMIN_SIGNED_IN,
|
|
12466
12568
|
request: {
|
|
12467
|
-
token:
|
|
12569
|
+
token: RESTRICTED4,
|
|
12468
12570
|
body: { currentPassword: "wrong", newPassword: "changed123" }
|
|
12469
12571
|
},
|
|
12470
12572
|
expect: { status: 403, error: "Invalid current password!" }
|