@eluvio/elv-client-js 4.0.146 → 4.1.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/dist/ElvClient-min.js +2 -68
- package/dist/ElvClient-min.js.LICENSE.txt +72 -0
- package/dist/ElvClient-node-min.js +2 -67
- package/dist/ElvClient-node-min.js.LICENSE.txt +72 -0
- package/dist/ElvFrameClient-min.js +2 -60
- package/dist/ElvFrameClient-min.js.LICENSE.txt +72 -0
- package/dist/ElvPermissionsClient-min.js +2 -60
- package/dist/ElvPermissionsClient-min.js.LICENSE.txt +72 -0
- package/dist/ElvWalletClient-min.js +2 -68
- package/dist/ElvWalletClient-min.js.LICENSE.txt +72 -0
- package/dist/ElvWalletClient-node-min.js +2 -67
- package/dist/ElvWalletClient-node-min.js.LICENSE.txt +72 -0
- package/dist/src/AuthorizationClient.js +704 -703
- package/dist/src/ContentObjectAudit.js +56 -56
- package/dist/src/Crypto.js +85 -86
- package/dist/src/ElvClient.js +483 -471
- package/dist/src/ElvWallet.js +23 -23
- package/dist/src/EthClient.js +308 -307
- package/dist/src/FrameClient.js +62 -62
- package/dist/src/HttpClient.js +59 -58
- package/dist/src/PermissionsClient.js +470 -470
- package/dist/src/RemoteSigner.js +77 -76
- package/dist/src/UserProfileClient.js +357 -354
- package/dist/src/Utils.js +65 -64
- package/dist/src/Validation.js +10 -10
- package/dist/src/client/ABRPublishing.js +237 -237
- package/dist/src/client/AccessGroups.js +477 -474
- package/dist/src/client/ContentAccess.js +1749 -1802
- package/dist/src/client/ContentManagement.js +871 -871
- package/dist/src/client/Contracts.js +575 -578
- package/dist/src/client/Files.js +700 -684
- package/dist/src/client/LiveStream.js +659 -650
- package/dist/src/client/NFT.js +14 -14
- package/dist/src/client/NTP.js +84 -84
- package/dist/src/client/Shares.js +49 -49
- package/dist/src/walletClient/ClientMethods.js +977 -951
- package/dist/src/walletClient/Notifications.js +14 -14
- package/dist/src/walletClient/Profile.js +66 -66
- package/dist/src/walletClient/Utils.js +15 -15
- package/dist/src/walletClient/index.js +557 -550
- package/package.json +17 -16
- package/src/ElvClient.js +1 -0
- package/src/FrameClient.js +12 -0
- package/src/client/AccessGroups.js +1 -1
- package/src/client/ContentAccess.js +44 -71
- package/testScripts/Test.js +5 -1
- package/webpack.config.js +10 -13
- package/dist/src/ContentObjectVerification.js +0 -281
|
@@ -176,150 +176,150 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
176
176
|
}, {
|
|
177
177
|
key: "FormatPermission",
|
|
178
178
|
value: function () {
|
|
179
|
-
var _FormatPermission = _asyncToGenerator(
|
|
180
|
-
var policyId, policyWriteToken, permission, subjectSource, subjectType, subjectId, subjectName, subjectNTPId, id, cachedName, contentSpaceLibraryId, permissionSpec;
|
|
181
|
-
return _regeneratorRuntime.wrap(function
|
|
179
|
+
var _FormatPermission = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
180
|
+
var policyId, policyWriteToken, permission, subjectSource, subjectType, subjectId, subjectName, subjectNTPId, id, cachedName, contentSpaceLibraryId, permissionSpec, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16;
|
|
181
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
182
182
|
while (1) switch (_context.prev = _context.next) {
|
|
183
183
|
case 0:
|
|
184
184
|
policyId = _ref.policyId, policyWriteToken = _ref.policyWriteToken, permission = _ref.permission;
|
|
185
185
|
subjectSource = permission.subject.type.startsWith("oauth") ? "oauth" : "fabric";
|
|
186
|
-
|
|
187
|
-
_context.next =
|
|
186
|
+
_t = permission.subject.type;
|
|
187
|
+
_context.next = _t === "otp" ? 1 : _t === "otp_subject" ? 2 : _t === "group" ? 3 : _t === "oauth_group" ? 3 : _t === "user" ? 4 : _t === "oauth_user" ? 4 : 5;
|
|
188
188
|
break;
|
|
189
|
-
case
|
|
189
|
+
case 1:
|
|
190
190
|
subjectType = "ntp";
|
|
191
191
|
subjectId = permission.subject.id;
|
|
192
|
-
return _context.abrupt("
|
|
193
|
-
case
|
|
192
|
+
return _context.abrupt("continue", 6);
|
|
193
|
+
case 2:
|
|
194
194
|
subjectType = "ntp_subject";
|
|
195
195
|
subjectId = permission.subject.id;
|
|
196
196
|
subjectName = subjectId;
|
|
197
197
|
subjectNTPId = permission.subject.otp_id;
|
|
198
|
-
return _context.abrupt("
|
|
199
|
-
case
|
|
198
|
+
return _context.abrupt("continue", 6);
|
|
199
|
+
case 3:
|
|
200
200
|
subjectType = "group";
|
|
201
201
|
subjectId = subjectSource === "oauth" ? permission.subject.oauth_id : this.client.utils.HashToAddress(permission.subject.id);
|
|
202
|
-
return _context.abrupt("
|
|
203
|
-
case
|
|
202
|
+
return _context.abrupt("continue", 6);
|
|
203
|
+
case 4:
|
|
204
204
|
subjectType = "user";
|
|
205
205
|
subjectId = subjectSource === "oauth" ? permission.subject.oauth_id : this.client.utils.HashToAddress(permission.subject.id);
|
|
206
|
-
return _context.abrupt("
|
|
207
|
-
case
|
|
206
|
+
return _context.abrupt("continue", 6);
|
|
207
|
+
case 5:
|
|
208
208
|
throw Error("Unknown subject type: " + permission.subject.type);
|
|
209
|
-
case
|
|
209
|
+
case 6:
|
|
210
210
|
id = permission.subject.oauth_id || permission.subject.id;
|
|
211
211
|
cachedName = this.subjectNames[id];
|
|
212
212
|
subjectName = subjectName || cachedName || permission.subject.id;
|
|
213
213
|
if (!(!cachedName && subjectSource === "fabric")) {
|
|
214
|
-
_context.next =
|
|
214
|
+
_context.next = 20;
|
|
215
215
|
break;
|
|
216
216
|
}
|
|
217
217
|
if (!(subjectType === "group")) {
|
|
218
|
-
_context.next =
|
|
218
|
+
_context.next = 10;
|
|
219
219
|
break;
|
|
220
220
|
}
|
|
221
|
-
_context.next =
|
|
221
|
+
_context.next = 7;
|
|
222
222
|
return this.client.ContentSpaceId();
|
|
223
|
-
case
|
|
223
|
+
case 7:
|
|
224
224
|
contentSpaceLibraryId = _context.sent.replace("ispc", "ilib");
|
|
225
|
-
_context.next =
|
|
225
|
+
_context.next = 8;
|
|
226
226
|
return this.client.ContentObjectMetadata({
|
|
227
227
|
libraryId: contentSpaceLibraryId,
|
|
228
228
|
objectId: this.client.utils.AddressToObjectId(subjectId),
|
|
229
229
|
metadataSubtree: UrlJoin("public", "name")
|
|
230
230
|
});
|
|
231
|
-
case
|
|
232
|
-
|
|
233
|
-
if (
|
|
234
|
-
_context.next =
|
|
231
|
+
case 8:
|
|
232
|
+
_t2 = _context.sent;
|
|
233
|
+
if (_t2) {
|
|
234
|
+
_context.next = 9;
|
|
235
235
|
break;
|
|
236
236
|
}
|
|
237
|
-
|
|
238
|
-
case
|
|
239
|
-
subjectName =
|
|
240
|
-
_context.next =
|
|
237
|
+
_t2 = subjectId;
|
|
238
|
+
case 9:
|
|
239
|
+
subjectName = _t2;
|
|
240
|
+
_context.next = 20;
|
|
241
241
|
break;
|
|
242
|
-
case
|
|
242
|
+
case 10:
|
|
243
243
|
if (!(subjectType === "user")) {
|
|
244
|
-
_context.next =
|
|
244
|
+
_context.next = 15;
|
|
245
245
|
break;
|
|
246
246
|
}
|
|
247
|
-
|
|
248
|
-
_context.next =
|
|
247
|
+
_t5 = this.client;
|
|
248
|
+
_context.next = 11;
|
|
249
249
|
return this.client.ContentObjectLibraryId({
|
|
250
250
|
objectId: policyId
|
|
251
251
|
});
|
|
252
|
-
case
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
libraryId:
|
|
259
|
-
objectId:
|
|
260
|
-
writeToken:
|
|
261
|
-
metadataSubtree:
|
|
252
|
+
case 11:
|
|
253
|
+
_t6 = _context.sent;
|
|
254
|
+
_t7 = policyId;
|
|
255
|
+
_t8 = policyWriteToken;
|
|
256
|
+
_t9 = UrlJoin("auth_policy_settings", "fabric_users", subjectId);
|
|
257
|
+
_t0 = {
|
|
258
|
+
libraryId: _t6,
|
|
259
|
+
objectId: _t7,
|
|
260
|
+
writeToken: _t8,
|
|
261
|
+
metadataSubtree: _t9
|
|
262
262
|
};
|
|
263
|
-
_context.next =
|
|
264
|
-
return
|
|
265
|
-
case
|
|
266
|
-
|
|
267
|
-
if (
|
|
268
|
-
_context.next =
|
|
263
|
+
_context.next = 12;
|
|
264
|
+
return _t5.ContentObjectMetadata.call(_t5, _t0);
|
|
265
|
+
case 12:
|
|
266
|
+
_t4 = _context.sent;
|
|
267
|
+
if (_t4) {
|
|
268
|
+
_context.next = 13;
|
|
269
269
|
break;
|
|
270
270
|
}
|
|
271
|
-
|
|
272
|
-
case
|
|
273
|
-
|
|
274
|
-
if (
|
|
275
|
-
_context.next =
|
|
271
|
+
_t4 = {};
|
|
272
|
+
case 13:
|
|
273
|
+
_t3 = _t4.name;
|
|
274
|
+
if (_t3) {
|
|
275
|
+
_context.next = 14;
|
|
276
276
|
break;
|
|
277
277
|
}
|
|
278
|
-
|
|
279
|
-
case
|
|
280
|
-
subjectName =
|
|
281
|
-
_context.next =
|
|
278
|
+
_t3 = subjectId;
|
|
279
|
+
case 14:
|
|
280
|
+
subjectName = _t3;
|
|
281
|
+
_context.next = 20;
|
|
282
282
|
break;
|
|
283
|
-
case
|
|
283
|
+
case 15:
|
|
284
284
|
if (!(subjectType === "ntp")) {
|
|
285
|
-
_context.next =
|
|
285
|
+
_context.next = 20;
|
|
286
286
|
break;
|
|
287
287
|
}
|
|
288
|
-
|
|
289
|
-
_context.next =
|
|
288
|
+
_t11 = this.client;
|
|
289
|
+
_context.next = 16;
|
|
290
290
|
return this.client.ContentObjectLibraryId({
|
|
291
291
|
objectId: policyId
|
|
292
292
|
});
|
|
293
|
-
case
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
libraryId:
|
|
300
|
-
objectId:
|
|
301
|
-
writeToken:
|
|
302
|
-
metadataSubtree:
|
|
293
|
+
case 16:
|
|
294
|
+
_t12 = _context.sent;
|
|
295
|
+
_t13 = policyId;
|
|
296
|
+
_t14 = policyWriteToken;
|
|
297
|
+
_t15 = UrlJoin("auth_policy_settings", "ntp_instances", subjectId);
|
|
298
|
+
_t16 = {
|
|
299
|
+
libraryId: _t12,
|
|
300
|
+
objectId: _t13,
|
|
301
|
+
writeToken: _t14,
|
|
302
|
+
metadataSubtree: _t15
|
|
303
303
|
};
|
|
304
|
-
_context.next =
|
|
305
|
-
return
|
|
306
|
-
case
|
|
307
|
-
|
|
308
|
-
if (
|
|
309
|
-
_context.next =
|
|
304
|
+
_context.next = 17;
|
|
305
|
+
return _t11.ContentObjectMetadata.call(_t11, _t16);
|
|
306
|
+
case 17:
|
|
307
|
+
_t10 = _context.sent;
|
|
308
|
+
if (_t10) {
|
|
309
|
+
_context.next = 18;
|
|
310
310
|
break;
|
|
311
311
|
}
|
|
312
|
-
|
|
313
|
-
case
|
|
314
|
-
|
|
315
|
-
if (
|
|
316
|
-
_context.next =
|
|
312
|
+
_t10 = {};
|
|
313
|
+
case 18:
|
|
314
|
+
_t1 = _t10.name;
|
|
315
|
+
if (_t1) {
|
|
316
|
+
_context.next = 19;
|
|
317
317
|
break;
|
|
318
318
|
}
|
|
319
|
-
|
|
320
|
-
case
|
|
321
|
-
subjectName =
|
|
322
|
-
case
|
|
319
|
+
_t1 = subjectId;
|
|
320
|
+
case 19:
|
|
321
|
+
subjectName = _t1;
|
|
322
|
+
case 20:
|
|
323
323
|
this.subjectNames[id] = subjectName;
|
|
324
324
|
permissionSpec = {
|
|
325
325
|
profileName: permission.profile,
|
|
@@ -338,7 +338,7 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
338
338
|
permissionSpec.end = permission.end;
|
|
339
339
|
}
|
|
340
340
|
return _context.abrupt("return", permissionSpec);
|
|
341
|
-
case
|
|
341
|
+
case 21:
|
|
342
342
|
case "end":
|
|
343
343
|
return _context.stop();
|
|
344
344
|
}
|
|
@@ -363,37 +363,37 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
363
363
|
}, {
|
|
364
364
|
key: "OpenOfflineDraft",
|
|
365
365
|
value: (function () {
|
|
366
|
-
var _OpenOfflineDraft = _asyncToGenerator(
|
|
366
|
+
var _OpenOfflineDraft = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
|
|
367
367
|
var policyId, policyLibraryId, policyWriteToken, meta;
|
|
368
|
-
return _regeneratorRuntime.wrap(function
|
|
368
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
369
369
|
while (1) switch (_context2.prev = _context2.next) {
|
|
370
370
|
case 0:
|
|
371
371
|
policyId = _ref2.policyId, policyLibraryId = _ref2.policyLibraryId, policyWriteToken = _ref2.policyWriteToken;
|
|
372
372
|
if (!(policyLibraryId == null)) {
|
|
373
|
-
_context2.next =
|
|
373
|
+
_context2.next = 2;
|
|
374
374
|
break;
|
|
375
375
|
}
|
|
376
|
-
_context2.next =
|
|
376
|
+
_context2.next = 1;
|
|
377
377
|
return this.client.ContentObjectLibraryId({
|
|
378
378
|
objectId: policyId
|
|
379
379
|
});
|
|
380
|
-
case
|
|
380
|
+
case 1:
|
|
381
381
|
policyLibraryId = _context2.sent;
|
|
382
|
-
case
|
|
383
|
-
_context2.next =
|
|
382
|
+
case 2:
|
|
383
|
+
_context2.next = 3;
|
|
384
384
|
return this.client.ContentObjectMetadata({
|
|
385
385
|
libraryId: policyLibraryId,
|
|
386
386
|
objectId: policyId,
|
|
387
387
|
writeToken: policyWriteToken
|
|
388
388
|
});
|
|
389
|
-
case
|
|
389
|
+
case 3:
|
|
390
390
|
meta = _context2.sent;
|
|
391
391
|
this.drafts[policyId] = {
|
|
392
392
|
meta: meta,
|
|
393
393
|
policyLibraryId: policyLibraryId,
|
|
394
394
|
policyWriteToken: policyWriteToken
|
|
395
395
|
};
|
|
396
|
-
case
|
|
396
|
+
case 4:
|
|
397
397
|
case "end":
|
|
398
398
|
return _context2.stop();
|
|
399
399
|
}
|
|
@@ -416,28 +416,28 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
416
416
|
}, {
|
|
417
417
|
key: "CloseOfflineDraft",
|
|
418
418
|
value: (function () {
|
|
419
|
-
var _CloseOfflineDraft = _asyncToGenerator(
|
|
419
|
+
var _CloseOfflineDraft = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref3) {
|
|
420
420
|
var policyId;
|
|
421
|
-
return _regeneratorRuntime.wrap(function
|
|
421
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
422
422
|
while (1) switch (_context3.prev = _context3.next) {
|
|
423
423
|
case 0:
|
|
424
424
|
policyId = _ref3.policyId;
|
|
425
425
|
if (!(this.drafts[policyId] == null)) {
|
|
426
|
-
_context3.next =
|
|
426
|
+
_context3.next = 1;
|
|
427
427
|
break;
|
|
428
428
|
}
|
|
429
429
|
throw Error("No draft open for policyId: " + policyId);
|
|
430
|
-
case
|
|
431
|
-
_context3.next =
|
|
430
|
+
case 1:
|
|
431
|
+
_context3.next = 2;
|
|
432
432
|
return this.client.ReplaceMetadata({
|
|
433
433
|
libraryId: this.drafts[policyId].policyLibraryId,
|
|
434
434
|
objectId: policyId,
|
|
435
435
|
writeToken: this.drafts[policyId].policyWriteToken,
|
|
436
436
|
metadata: this.drafts[policyId].meta
|
|
437
437
|
});
|
|
438
|
-
case
|
|
438
|
+
case 2:
|
|
439
439
|
this.drafts[policyId] = null;
|
|
440
|
-
case
|
|
440
|
+
case 3:
|
|
441
441
|
case "end":
|
|
442
442
|
return _context3.stop();
|
|
443
443
|
}
|
|
@@ -462,41 +462,41 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
462
462
|
}, {
|
|
463
463
|
key: "PolicyItems",
|
|
464
464
|
value: (function () {
|
|
465
|
-
var _PolicyItems = _asyncToGenerator(
|
|
466
|
-
var policyId, policyWriteToken;
|
|
467
|
-
return _regeneratorRuntime.wrap(function
|
|
465
|
+
var _PolicyItems = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref4) {
|
|
466
|
+
var policyId, policyWriteToken, _t17, _t18, _t19, _t20, _t21, _t22, _t23;
|
|
467
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
468
468
|
while (1) switch (_context4.prev = _context4.next) {
|
|
469
469
|
case 0:
|
|
470
470
|
policyId = _ref4.policyId, policyWriteToken = _ref4.policyWriteToken;
|
|
471
|
-
|
|
472
|
-
_context4.next =
|
|
471
|
+
_t18 = this.client;
|
|
472
|
+
_context4.next = 1;
|
|
473
473
|
return this.client.ContentObjectLibraryId({
|
|
474
474
|
objectId: policyId
|
|
475
475
|
});
|
|
476
|
-
case
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
libraryId:
|
|
483
|
-
objectId:
|
|
484
|
-
writeToken:
|
|
476
|
+
case 1:
|
|
477
|
+
_t19 = _context4.sent;
|
|
478
|
+
_t20 = policyId;
|
|
479
|
+
_t21 = policyWriteToken;
|
|
480
|
+
_t22 = ["*/display_title"];
|
|
481
|
+
_t23 = {
|
|
482
|
+
libraryId: _t19,
|
|
483
|
+
objectId: _t20,
|
|
484
|
+
writeToken: _t21,
|
|
485
485
|
metadataSubtree: "auth_policy_spec",
|
|
486
|
-
select:
|
|
486
|
+
select: _t22
|
|
487
487
|
};
|
|
488
|
-
_context4.next =
|
|
489
|
-
return
|
|
490
|
-
case
|
|
491
|
-
|
|
492
|
-
if (
|
|
493
|
-
_context4.next =
|
|
488
|
+
_context4.next = 2;
|
|
489
|
+
return _t18.ContentObjectMetadata.call(_t18, _t23);
|
|
490
|
+
case 2:
|
|
491
|
+
_t17 = _context4.sent;
|
|
492
|
+
if (_t17) {
|
|
493
|
+
_context4.next = 3;
|
|
494
494
|
break;
|
|
495
495
|
}
|
|
496
|
-
|
|
497
|
-
case
|
|
498
|
-
return _context4.abrupt("return",
|
|
499
|
-
case
|
|
496
|
+
_t17 = {};
|
|
497
|
+
case 3:
|
|
498
|
+
return _context4.abrupt("return", _t17);
|
|
499
|
+
case 4:
|
|
500
500
|
case "end":
|
|
501
501
|
return _context4.stop();
|
|
502
502
|
}
|
|
@@ -521,39 +521,39 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
521
521
|
}, {
|
|
522
522
|
key: "ItemPolicy",
|
|
523
523
|
value: (function () {
|
|
524
|
-
var _ItemPolicy = _asyncToGenerator(
|
|
524
|
+
var _ItemPolicy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref5) {
|
|
525
525
|
var policyId, policyWriteToken, itemId, profiles, permissions;
|
|
526
|
-
return _regeneratorRuntime.wrap(function
|
|
526
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
527
527
|
while (1) switch (_context5.prev = _context5.next) {
|
|
528
528
|
case 0:
|
|
529
529
|
policyId = _ref5.policyId, policyWriteToken = _ref5.policyWriteToken, itemId = _ref5.itemId;
|
|
530
|
-
_context5.next =
|
|
530
|
+
_context5.next = 1;
|
|
531
531
|
return this.ItemProfiles({
|
|
532
532
|
policyId: policyId,
|
|
533
533
|
policyWriteToken: policyWriteToken,
|
|
534
534
|
itemId: itemId
|
|
535
535
|
});
|
|
536
|
-
case
|
|
536
|
+
case 1:
|
|
537
537
|
profiles = _context5.sent;
|
|
538
|
-
_context5.next =
|
|
538
|
+
_context5.next = 2;
|
|
539
539
|
return this.ItemPermissions({
|
|
540
540
|
policyId: policyId,
|
|
541
541
|
policyWriteToken: policyWriteToken,
|
|
542
542
|
itemId: itemId
|
|
543
543
|
});
|
|
544
|
-
case
|
|
544
|
+
case 2:
|
|
545
545
|
permissions = _context5.sent;
|
|
546
546
|
if (!(!profiles || !permissions)) {
|
|
547
|
-
_context5.next =
|
|
547
|
+
_context5.next = 3;
|
|
548
548
|
break;
|
|
549
549
|
}
|
|
550
550
|
return _context5.abrupt("return");
|
|
551
|
-
case
|
|
551
|
+
case 3:
|
|
552
552
|
return _context5.abrupt("return", {
|
|
553
553
|
profiles: profiles,
|
|
554
554
|
permissions: permissions
|
|
555
555
|
});
|
|
556
|
-
case
|
|
556
|
+
case 4:
|
|
557
557
|
case "end":
|
|
558
558
|
return _context5.stop();
|
|
559
559
|
}
|
|
@@ -578,10 +578,10 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
578
578
|
}, {
|
|
579
579
|
key: "CreateItemPolicy",
|
|
580
580
|
value: (function () {
|
|
581
|
-
var _CreateItemPolicy = _asyncToGenerator(
|
|
581
|
+
var _CreateItemPolicy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref6) {
|
|
582
582
|
var _this2 = this;
|
|
583
|
-
var policyId, policyWriteToken, itemId, _ref6$profiles, profiles, metadata, assetMetadata, displayTitle, itemSpec;
|
|
584
|
-
return _regeneratorRuntime.wrap(function
|
|
583
|
+
var policyId, policyWriteToken, itemId, _ref6$profiles, profiles, metadata, assetMetadata, displayTitle, itemSpec, _t24, _t25, _t26, _t27, _t28, _t29, _t30, _t31, _t32, _t33, _t34, _t35, _t36;
|
|
584
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
585
585
|
while (1) switch (_context6.prev = _context6.next) {
|
|
586
586
|
case 0:
|
|
587
587
|
policyId = _ref6.policyId, policyWriteToken = _ref6.policyWriteToken, itemId = _ref6.itemId, _ref6$profiles = _ref6.profiles, profiles = _ref6$profiles === void 0 ? {} : _ref6$profiles;
|
|
@@ -589,31 +589,31 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
589
589
|
ValidatePresence("policyWriteToken", policyWriteToken);
|
|
590
590
|
ValidatePresence("itemId", itemId);
|
|
591
591
|
ValidatePresence("profiles", profiles);
|
|
592
|
-
|
|
593
|
-
_context6.next =
|
|
592
|
+
_t25 = this.client;
|
|
593
|
+
_context6.next = 1;
|
|
594
594
|
return this.client.ContentObjectLibraryId({
|
|
595
595
|
objectId: itemId
|
|
596
596
|
});
|
|
597
|
-
case
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
libraryId:
|
|
603
|
-
objectId:
|
|
604
|
-
select:
|
|
597
|
+
case 1:
|
|
598
|
+
_t26 = _context6.sent;
|
|
599
|
+
_t27 = itemId;
|
|
600
|
+
_t28 = ["public/name", "public/asset_metadata/title", "public/asset_metadata/display_title"];
|
|
601
|
+
_t29 = {
|
|
602
|
+
libraryId: _t26,
|
|
603
|
+
objectId: _t27,
|
|
604
|
+
select: _t28
|
|
605
605
|
};
|
|
606
|
-
_context6.next =
|
|
607
|
-
return
|
|
608
|
-
case
|
|
609
|
-
|
|
610
|
-
if (
|
|
611
|
-
_context6.next =
|
|
606
|
+
_context6.next = 2;
|
|
607
|
+
return _t25.ContentObjectMetadata.call(_t25, _t29);
|
|
608
|
+
case 2:
|
|
609
|
+
_t24 = _context6.sent;
|
|
610
|
+
if (_t24) {
|
|
611
|
+
_context6.next = 3;
|
|
612
612
|
break;
|
|
613
613
|
}
|
|
614
|
-
|
|
615
|
-
case
|
|
616
|
-
metadata =
|
|
614
|
+
_t24 = {};
|
|
615
|
+
case 3:
|
|
616
|
+
metadata = _t24;
|
|
617
617
|
assetMetadata = (metadata["public"] || {}).asset_metadata || {};
|
|
618
618
|
displayTitle = assetMetadata.display_title || assetMetadata.title || (metadata["public"] || {}).name;
|
|
619
619
|
itemSpec = {
|
|
@@ -624,27 +624,27 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
624
624
|
Object.keys(profiles).forEach(function (profileName) {
|
|
625
625
|
itemSpec.profiles[profileName] = _this2.FormatProfile(profiles[profileName]);
|
|
626
626
|
});
|
|
627
|
-
|
|
628
|
-
_context6.next =
|
|
627
|
+
_t30 = this.client;
|
|
628
|
+
_context6.next = 4;
|
|
629
629
|
return this.client.ContentObjectLibraryId({
|
|
630
630
|
objectId: policyId
|
|
631
631
|
});
|
|
632
|
-
case
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
libraryId:
|
|
640
|
-
objectId:
|
|
641
|
-
writeToken:
|
|
642
|
-
metadataSubtree:
|
|
643
|
-
metadata:
|
|
632
|
+
case 4:
|
|
633
|
+
_t31 = _context6.sent;
|
|
634
|
+
_t32 = policyId;
|
|
635
|
+
_t33 = policyWriteToken;
|
|
636
|
+
_t34 = UrlJoin("auth_policy_spec", itemId);
|
|
637
|
+
_t35 = itemSpec;
|
|
638
|
+
_t36 = {
|
|
639
|
+
libraryId: _t31,
|
|
640
|
+
objectId: _t32,
|
|
641
|
+
writeToken: _t33,
|
|
642
|
+
metadataSubtree: _t34,
|
|
643
|
+
metadata: _t35
|
|
644
644
|
};
|
|
645
|
-
_context6.next =
|
|
646
|
-
return
|
|
647
|
-
case
|
|
645
|
+
_context6.next = 5;
|
|
646
|
+
return _t30.ReplaceMetadata.call(_t30, _t36);
|
|
647
|
+
case 5:
|
|
648
648
|
case "end":
|
|
649
649
|
return _context6.stop();
|
|
650
650
|
}
|
|
@@ -668,34 +668,34 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
668
668
|
}, {
|
|
669
669
|
key: "RemoveItemPolicy",
|
|
670
670
|
value: (function () {
|
|
671
|
-
var _RemoveItemPolicy = _asyncToGenerator(
|
|
672
|
-
var policyId, policyWriteToken, itemId;
|
|
673
|
-
return _regeneratorRuntime.wrap(function
|
|
671
|
+
var _RemoveItemPolicy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref7) {
|
|
672
|
+
var policyId, policyWriteToken, itemId, _t37, _t38, _t39, _t40, _t41, _t42;
|
|
673
|
+
return _regeneratorRuntime.wrap(function (_context7) {
|
|
674
674
|
while (1) switch (_context7.prev = _context7.next) {
|
|
675
675
|
case 0:
|
|
676
676
|
policyId = _ref7.policyId, policyWriteToken = _ref7.policyWriteToken, itemId = _ref7.itemId;
|
|
677
677
|
ValidatePresence("policyId", policyId);
|
|
678
678
|
ValidatePresence("policyWriteToken", policyWriteToken);
|
|
679
679
|
ValidatePresence("itemId", itemId);
|
|
680
|
-
|
|
681
|
-
_context7.next =
|
|
680
|
+
_t37 = this.client;
|
|
681
|
+
_context7.next = 1;
|
|
682
682
|
return this.client.ContentObjectLibraryId({
|
|
683
683
|
objectId: policyId
|
|
684
684
|
});
|
|
685
|
-
case
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
libraryId:
|
|
692
|
-
objectId:
|
|
693
|
-
writeToken:
|
|
694
|
-
metadataSubtree:
|
|
685
|
+
case 1:
|
|
686
|
+
_t38 = _context7.sent;
|
|
687
|
+
_t39 = policyId;
|
|
688
|
+
_t40 = policyWriteToken;
|
|
689
|
+
_t41 = UrlJoin("auth_policy_spec", itemId);
|
|
690
|
+
_t42 = {
|
|
691
|
+
libraryId: _t38,
|
|
692
|
+
objectId: _t39,
|
|
693
|
+
writeToken: _t40,
|
|
694
|
+
metadataSubtree: _t41
|
|
695
695
|
};
|
|
696
|
-
_context7.next =
|
|
697
|
-
return
|
|
698
|
-
case
|
|
696
|
+
_context7.next = 2;
|
|
697
|
+
return _t37.DeleteMetadata.call(_t37, _t42);
|
|
698
|
+
case 2:
|
|
699
699
|
case "end":
|
|
700
700
|
return _context7.stop();
|
|
701
701
|
}
|
|
@@ -721,33 +721,33 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
721
721
|
}, {
|
|
722
722
|
key: "ItemProfiles",
|
|
723
723
|
value: (function () {
|
|
724
|
-
var _ItemProfiles = _asyncToGenerator(
|
|
725
|
-
var policyId, policyWriteToken, itemId, profileName;
|
|
726
|
-
return _regeneratorRuntime.wrap(function
|
|
724
|
+
var _ItemProfiles = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref8) {
|
|
725
|
+
var policyId, policyWriteToken, itemId, profileName, _t43, _t44, _t45, _t46, _t47, _t48;
|
|
726
|
+
return _regeneratorRuntime.wrap(function (_context8) {
|
|
727
727
|
while (1) switch (_context8.prev = _context8.next) {
|
|
728
728
|
case 0:
|
|
729
729
|
policyId = _ref8.policyId, policyWriteToken = _ref8.policyWriteToken, itemId = _ref8.itemId, profileName = _ref8.profileName;
|
|
730
|
-
|
|
731
|
-
_context8.next =
|
|
730
|
+
_t43 = this.client;
|
|
731
|
+
_context8.next = 1;
|
|
732
732
|
return this.client.ContentObjectLibraryId({
|
|
733
733
|
objectId: policyId
|
|
734
734
|
});
|
|
735
|
-
case
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
libraryId:
|
|
742
|
-
objectId:
|
|
743
|
-
writeToken:
|
|
744
|
-
metadataSubtree:
|
|
735
|
+
case 1:
|
|
736
|
+
_t44 = _context8.sent;
|
|
737
|
+
_t45 = policyId;
|
|
738
|
+
_t46 = policyWriteToken;
|
|
739
|
+
_t47 = UrlJoin("auth_policy_spec", itemId, "profiles", profileName || "");
|
|
740
|
+
_t48 = {
|
|
741
|
+
libraryId: _t44,
|
|
742
|
+
objectId: _t45,
|
|
743
|
+
writeToken: _t46,
|
|
744
|
+
metadataSubtree: _t47
|
|
745
745
|
};
|
|
746
|
-
_context8.next =
|
|
747
|
-
return
|
|
748
|
-
case
|
|
746
|
+
_context8.next = 2;
|
|
747
|
+
return _t43.ContentObjectMetadata.call(_t43, _t48);
|
|
748
|
+
case 2:
|
|
749
749
|
return _context8.abrupt("return", _context8.sent);
|
|
750
|
-
case
|
|
750
|
+
case 3:
|
|
751
751
|
case "end":
|
|
752
752
|
return _context8.stop();
|
|
753
753
|
}
|
|
@@ -774,9 +774,9 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
774
774
|
}, {
|
|
775
775
|
key: "SetProfile",
|
|
776
776
|
value: (function () {
|
|
777
|
-
var _SetProfile = _asyncToGenerator(
|
|
778
|
-
var policyId, policyWriteToken, itemId, profileName, profileSpec;
|
|
779
|
-
return _regeneratorRuntime.wrap(function
|
|
777
|
+
var _SetProfile = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref9) {
|
|
778
|
+
var policyId, policyWriteToken, itemId, profileName, profileSpec, _t49, _t50, _t51, _t52, _t53, _t54, _t55;
|
|
779
|
+
return _regeneratorRuntime.wrap(function (_context9) {
|
|
780
780
|
while (1) switch (_context9.prev = _context9.next) {
|
|
781
781
|
case 0:
|
|
782
782
|
policyId = _ref9.policyId, policyWriteToken = _ref9.policyWriteToken, itemId = _ref9.itemId, profileName = _ref9.profileName, profileSpec = _ref9.profileSpec;
|
|
@@ -785,27 +785,27 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
785
785
|
ValidatePresence("itemId", itemId);
|
|
786
786
|
ValidatePresence("profileName", profileName);
|
|
787
787
|
ValidatePresence("profileSpec", profileSpec);
|
|
788
|
-
|
|
789
|
-
_context9.next =
|
|
788
|
+
_t49 = this.client;
|
|
789
|
+
_context9.next = 1;
|
|
790
790
|
return this.client.ContentObjectLibraryId({
|
|
791
791
|
objectId: policyId
|
|
792
792
|
});
|
|
793
|
-
case
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
libraryId:
|
|
801
|
-
objectId:
|
|
802
|
-
writeToken:
|
|
803
|
-
metadataSubtree:
|
|
804
|
-
metadata:
|
|
793
|
+
case 1:
|
|
794
|
+
_t50 = _context9.sent;
|
|
795
|
+
_t51 = policyId;
|
|
796
|
+
_t52 = policyWriteToken;
|
|
797
|
+
_t53 = UrlJoin("auth_policy_spec", itemId, "profiles", profileName);
|
|
798
|
+
_t54 = this.FormatProfile(profileSpec);
|
|
799
|
+
_t55 = {
|
|
800
|
+
libraryId: _t50,
|
|
801
|
+
objectId: _t51,
|
|
802
|
+
writeToken: _t52,
|
|
803
|
+
metadataSubtree: _t53,
|
|
804
|
+
metadata: _t54
|
|
805
805
|
};
|
|
806
|
-
_context9.next =
|
|
807
|
-
return
|
|
808
|
-
case
|
|
806
|
+
_context9.next = 2;
|
|
807
|
+
return _t49.ReplaceMetadata.call(_t49, _t55);
|
|
808
|
+
case 2:
|
|
809
809
|
case "end":
|
|
810
810
|
return _context9.stop();
|
|
811
811
|
}
|
|
@@ -832,41 +832,41 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
832
832
|
}, {
|
|
833
833
|
key: "RemoveProfile",
|
|
834
834
|
value: (function () {
|
|
835
|
-
var _RemoveProfile = _asyncToGenerator(
|
|
836
|
-
var policyId, policyWriteToken, itemId, profileName;
|
|
837
|
-
return _regeneratorRuntime.wrap(function
|
|
838
|
-
while (1) switch (
|
|
835
|
+
var _RemoveProfile = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(_ref0) {
|
|
836
|
+
var policyId, policyWriteToken, itemId, profileName, _t56, _t57, _t58, _t59, _t60, _t61;
|
|
837
|
+
return _regeneratorRuntime.wrap(function (_context0) {
|
|
838
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
839
839
|
case 0:
|
|
840
|
-
policyId =
|
|
840
|
+
policyId = _ref0.policyId, policyWriteToken = _ref0.policyWriteToken, itemId = _ref0.itemId, profileName = _ref0.profileName;
|
|
841
841
|
ValidatePresence("policyId", policyId);
|
|
842
842
|
ValidatePresence("policyWriteToken", policyWriteToken);
|
|
843
843
|
ValidatePresence("itemId", itemId);
|
|
844
844
|
ValidatePresence("profileName", profileName);
|
|
845
|
-
|
|
846
|
-
|
|
845
|
+
_t56 = this.client;
|
|
846
|
+
_context0.next = 1;
|
|
847
847
|
return this.client.ContentObjectLibraryId({
|
|
848
848
|
objectId: policyId
|
|
849
849
|
});
|
|
850
|
-
case
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
libraryId:
|
|
857
|
-
objectId:
|
|
858
|
-
writeToken:
|
|
859
|
-
metadataSubtree:
|
|
850
|
+
case 1:
|
|
851
|
+
_t57 = _context0.sent;
|
|
852
|
+
_t58 = policyId;
|
|
853
|
+
_t59 = policyWriteToken;
|
|
854
|
+
_t60 = UrlJoin("auth_policy_spec", itemId, "profiles", profileName);
|
|
855
|
+
_t61 = {
|
|
856
|
+
libraryId: _t57,
|
|
857
|
+
objectId: _t58,
|
|
858
|
+
writeToken: _t59,
|
|
859
|
+
metadataSubtree: _t60
|
|
860
860
|
};
|
|
861
|
-
|
|
862
|
-
return
|
|
863
|
-
case
|
|
861
|
+
_context0.next = 2;
|
|
862
|
+
return _t56.DeleteMetadata.call(_t56, _t61);
|
|
863
|
+
case 2:
|
|
864
864
|
case "end":
|
|
865
|
-
return
|
|
865
|
+
return _context0.stop();
|
|
866
866
|
}
|
|
867
|
-
},
|
|
867
|
+
}, _callee0, this);
|
|
868
868
|
}));
|
|
869
|
-
function RemoveProfile(
|
|
869
|
+
function RemoveProfile(_x0) {
|
|
870
870
|
return _RemoveProfile.apply(this, arguments);
|
|
871
871
|
}
|
|
872
872
|
return RemoveProfile;
|
|
@@ -887,68 +887,68 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
887
887
|
}, {
|
|
888
888
|
key: "ItemPermissions",
|
|
889
889
|
value: (function () {
|
|
890
|
-
var _ItemPermissions = _asyncToGenerator(
|
|
890
|
+
var _ItemPermissions = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref1) {
|
|
891
891
|
var _this3 = this;
|
|
892
|
-
var policyId, policyWriteToken, itemId, libraryId, permissions;
|
|
893
|
-
return _regeneratorRuntime.wrap(function
|
|
894
|
-
while (1) switch (
|
|
892
|
+
var policyId, policyWriteToken, itemId, libraryId, permissions, _t62;
|
|
893
|
+
return _regeneratorRuntime.wrap(function (_context10) {
|
|
894
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
895
895
|
case 0:
|
|
896
|
-
policyId =
|
|
897
|
-
|
|
896
|
+
policyId = _ref1.policyId, policyWriteToken = _ref1.policyWriteToken, itemId = _ref1.itemId;
|
|
897
|
+
_context10.next = 1;
|
|
898
898
|
return this.client.ContentObjectLibraryId({
|
|
899
899
|
objectId: policyId
|
|
900
900
|
});
|
|
901
|
-
case
|
|
902
|
-
libraryId =
|
|
903
|
-
|
|
901
|
+
case 1:
|
|
902
|
+
libraryId = _context10.sent;
|
|
903
|
+
_context10.next = 2;
|
|
904
904
|
return this.client.ContentObjectMetadata({
|
|
905
905
|
libraryId: libraryId,
|
|
906
906
|
objectId: policyId,
|
|
907
907
|
writeToken: policyWriteToken,
|
|
908
908
|
metadataSubtree: UrlJoin("auth_policy_spec", itemId, "permissions")
|
|
909
909
|
});
|
|
910
|
-
case
|
|
911
|
-
|
|
912
|
-
if (
|
|
913
|
-
|
|
910
|
+
case 2:
|
|
911
|
+
_t62 = _context10.sent;
|
|
912
|
+
if (_t62) {
|
|
913
|
+
_context10.next = 3;
|
|
914
914
|
break;
|
|
915
915
|
}
|
|
916
|
-
|
|
917
|
-
case
|
|
918
|
-
permissions =
|
|
919
|
-
|
|
920
|
-
return Promise.all(permissions.map(
|
|
921
|
-
var
|
|
922
|
-
return _regeneratorRuntime.wrap(function
|
|
923
|
-
while (1) switch (
|
|
916
|
+
_t62 = [];
|
|
917
|
+
case 3:
|
|
918
|
+
permissions = _t62;
|
|
919
|
+
_context10.next = 4;
|
|
920
|
+
return Promise.all(permissions.map(/*#__PURE__*/function () {
|
|
921
|
+
var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1(permission) {
|
|
922
|
+
return _regeneratorRuntime.wrap(function (_context1) {
|
|
923
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
924
924
|
case 0:
|
|
925
|
-
|
|
925
|
+
_context1.next = 1;
|
|
926
926
|
return _this3.FormatPermission({
|
|
927
927
|
policyId: policyId,
|
|
928
928
|
policyWriteToken: policyWriteToken,
|
|
929
929
|
permission: permission
|
|
930
930
|
});
|
|
931
|
+
case 1:
|
|
932
|
+
return _context1.abrupt("return", _context1.sent);
|
|
931
933
|
case 2:
|
|
932
|
-
return _context11.abrupt("return", _context11.sent);
|
|
933
|
-
case 3:
|
|
934
934
|
case "end":
|
|
935
|
-
return
|
|
935
|
+
return _context1.stop();
|
|
936
936
|
}
|
|
937
|
-
},
|
|
937
|
+
}, _callee1);
|
|
938
938
|
}));
|
|
939
|
-
return function (
|
|
940
|
-
return
|
|
939
|
+
return function (_x10) {
|
|
940
|
+
return _ref10.apply(this, arguments);
|
|
941
941
|
};
|
|
942
942
|
}()));
|
|
943
|
-
case
|
|
944
|
-
return
|
|
945
|
-
case
|
|
943
|
+
case 4:
|
|
944
|
+
return _context10.abrupt("return", _context10.sent);
|
|
945
|
+
case 5:
|
|
946
946
|
case "end":
|
|
947
|
-
return
|
|
947
|
+
return _context10.stop();
|
|
948
948
|
}
|
|
949
|
-
},
|
|
949
|
+
}, _callee10, this);
|
|
950
950
|
}));
|
|
951
|
-
function ItemPermissions(
|
|
951
|
+
function ItemPermissions(_x1) {
|
|
952
952
|
return _ItemPermissions.apply(this, arguments);
|
|
953
953
|
}
|
|
954
954
|
return ItemPermissions;
|
|
@@ -974,12 +974,12 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
974
974
|
}, {
|
|
975
975
|
key: "SetPermission",
|
|
976
976
|
value: (function () {
|
|
977
|
-
var _SetPermission = _asyncToGenerator(
|
|
978
|
-
var policyId, policyWriteToken, itemId,
|
|
979
|
-
return _regeneratorRuntime.wrap(function
|
|
980
|
-
while (1) switch (
|
|
977
|
+
var _SetPermission = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref11) {
|
|
978
|
+
var policyId, policyWriteToken, itemId, _ref11$subjectSource, subjectSource, _ref11$subjectType, subjectType, subjectName, subjectId, subjectNTPId, profileName, start, end, offlineDraft, policyLibraryId, existingPermissions, index, permissionSpec, subjectInfo, newMeta, userInfo, _newMeta, _userInfo;
|
|
979
|
+
return _regeneratorRuntime.wrap(function (_context11) {
|
|
980
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
981
981
|
case 0:
|
|
982
|
-
policyId =
|
|
982
|
+
policyId = _ref11.policyId, policyWriteToken = _ref11.policyWriteToken, itemId = _ref11.itemId, _ref11$subjectSource = _ref11.subjectSource, subjectSource = _ref11$subjectSource === void 0 ? "fabric" : _ref11$subjectSource, _ref11$subjectType = _ref11.subjectType, subjectType = _ref11$subjectType === void 0 ? "group" : _ref11$subjectType, subjectName = _ref11.subjectName, subjectId = _ref11.subjectId, subjectNTPId = _ref11.subjectNTPId, profileName = _ref11.profileName, start = _ref11.start, end = _ref11.end;
|
|
983
983
|
ValidatePresence("policyId", policyId);
|
|
984
984
|
ValidatePresence("policyWriteToken", policyWriteToken);
|
|
985
985
|
ValidatePresence("itemId", itemId);
|
|
@@ -994,16 +994,16 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
994
994
|
offlineDraft = this.offline && this.drafts[policyId] != null;
|
|
995
995
|
policyLibraryId = null;
|
|
996
996
|
if (offlineDraft) {
|
|
997
|
-
|
|
997
|
+
_context11.next = 2;
|
|
998
998
|
break;
|
|
999
999
|
}
|
|
1000
|
-
|
|
1000
|
+
_context11.next = 1;
|
|
1001
1001
|
return this.client.ContentObjectLibraryId({
|
|
1002
1002
|
objectId: policyId
|
|
1003
1003
|
});
|
|
1004
|
-
case
|
|
1005
|
-
policyLibraryId =
|
|
1006
|
-
case
|
|
1004
|
+
case 1:
|
|
1005
|
+
policyLibraryId = _context11.sent;
|
|
1006
|
+
case 2:
|
|
1007
1007
|
// Allow address to be passed in for fabric subjects, though spec requires iusr/igrp hash
|
|
1008
1008
|
if (subjectSource === "fabric") {
|
|
1009
1009
|
if (subjectType === "group") {
|
|
@@ -1017,35 +1017,35 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
1017
1017
|
}
|
|
1018
1018
|
}
|
|
1019
1019
|
if (!offlineDraft) {
|
|
1020
|
-
|
|
1020
|
+
_context11.next = 3;
|
|
1021
1021
|
break;
|
|
1022
1022
|
}
|
|
1023
1023
|
existingPermissions = this.drafts[policyId].meta["auth_policy_spec"][itemId];
|
|
1024
|
-
|
|
1024
|
+
_context11.next = 5;
|
|
1025
1025
|
break;
|
|
1026
|
-
case
|
|
1027
|
-
|
|
1026
|
+
case 3:
|
|
1027
|
+
_context11.next = 4;
|
|
1028
1028
|
return this.client.ContentObjectMetadata({
|
|
1029
1029
|
libraryId: policyLibraryId,
|
|
1030
1030
|
objectId: policyId,
|
|
1031
1031
|
writeToken: policyWriteToken,
|
|
1032
1032
|
metadataSubtree: UrlJoin("auth_policy_spec", itemId)
|
|
1033
1033
|
});
|
|
1034
|
-
case
|
|
1035
|
-
existingPermissions =
|
|
1036
|
-
case
|
|
1034
|
+
case 4:
|
|
1035
|
+
existingPermissions = _context11.sent;
|
|
1036
|
+
case 5:
|
|
1037
1037
|
if (existingPermissions) {
|
|
1038
|
-
|
|
1038
|
+
_context11.next = 6;
|
|
1039
1039
|
break;
|
|
1040
1040
|
}
|
|
1041
1041
|
throw Error("Unable to add permissions to uninitialized item");
|
|
1042
|
-
case
|
|
1042
|
+
case 6:
|
|
1043
1043
|
if (existingPermissions.profiles[profileName]) {
|
|
1044
|
-
|
|
1044
|
+
_context11.next = 7;
|
|
1045
1045
|
break;
|
|
1046
1046
|
}
|
|
1047
1047
|
throw Error("Profile '".concat(profileName, "' does not exist"));
|
|
1048
|
-
case
|
|
1048
|
+
case 7:
|
|
1049
1049
|
index = existingPermissions.permissions.findIndex(function (permission) {
|
|
1050
1050
|
if (subjectSource === "fabric") {
|
|
1051
1051
|
return permission.subject.id === subjectId;
|
|
@@ -1066,44 +1066,44 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
1066
1066
|
permissionSpec.end = end;
|
|
1067
1067
|
}
|
|
1068
1068
|
if (!(subjectSource === "fabric")) {
|
|
1069
|
-
|
|
1069
|
+
_context11.next = 13;
|
|
1070
1070
|
break;
|
|
1071
1071
|
}
|
|
1072
1072
|
if (!(subjectType === "group")) {
|
|
1073
|
-
|
|
1073
|
+
_context11.next = 8;
|
|
1074
1074
|
break;
|
|
1075
1075
|
}
|
|
1076
1076
|
subjectInfo = {
|
|
1077
1077
|
id: subjectId,
|
|
1078
1078
|
type: "group"
|
|
1079
1079
|
};
|
|
1080
|
-
|
|
1080
|
+
_context11.next = 12;
|
|
1081
1081
|
break;
|
|
1082
|
-
case
|
|
1082
|
+
case 8:
|
|
1083
1083
|
if (!(subjectType === "user")) {
|
|
1084
|
-
|
|
1084
|
+
_context11.next = 9;
|
|
1085
1085
|
break;
|
|
1086
1086
|
}
|
|
1087
1087
|
subjectInfo = {
|
|
1088
1088
|
id: subjectId,
|
|
1089
1089
|
type: "user"
|
|
1090
1090
|
};
|
|
1091
|
-
|
|
1091
|
+
_context11.next = 12;
|
|
1092
1092
|
break;
|
|
1093
|
-
case
|
|
1093
|
+
case 9:
|
|
1094
1094
|
if (!(subjectType === "ntp")) {
|
|
1095
|
-
|
|
1095
|
+
_context11.next = 10;
|
|
1096
1096
|
break;
|
|
1097
1097
|
}
|
|
1098
1098
|
subjectInfo = {
|
|
1099
1099
|
id: subjectId,
|
|
1100
1100
|
type: "otp"
|
|
1101
1101
|
};
|
|
1102
|
-
|
|
1102
|
+
_context11.next = 12;
|
|
1103
1103
|
break;
|
|
1104
|
-
case
|
|
1104
|
+
case 10:
|
|
1105
1105
|
if (!(subjectType === "ntp_subject")) {
|
|
1106
|
-
|
|
1106
|
+
_context11.next = 11;
|
|
1107
1107
|
break;
|
|
1108
1108
|
}
|
|
1109
1109
|
subjectInfo = {
|
|
@@ -1111,20 +1111,20 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
1111
1111
|
otp_id: subjectNTPId,
|
|
1112
1112
|
type: "otp_subject"
|
|
1113
1113
|
};
|
|
1114
|
-
|
|
1114
|
+
_context11.next = 12;
|
|
1115
1115
|
break;
|
|
1116
|
-
case
|
|
1116
|
+
case 11:
|
|
1117
1117
|
throw Error("Invalid subject type: ".concat(subjectType));
|
|
1118
|
-
case
|
|
1119
|
-
|
|
1118
|
+
case 12:
|
|
1119
|
+
_context11.next = 18;
|
|
1120
1120
|
break;
|
|
1121
|
-
case
|
|
1121
|
+
case 13:
|
|
1122
1122
|
if (!(subjectSource === "oauth")) {
|
|
1123
|
-
|
|
1123
|
+
_context11.next = 17;
|
|
1124
1124
|
break;
|
|
1125
1125
|
}
|
|
1126
1126
|
if (!(subjectType === "group")) {
|
|
1127
|
-
|
|
1127
|
+
_context11.next = 14;
|
|
1128
1128
|
break;
|
|
1129
1129
|
}
|
|
1130
1130
|
subjectInfo = {
|
|
@@ -1132,11 +1132,11 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
1132
1132
|
oauth_id: subjectId,
|
|
1133
1133
|
type: "oauth_group"
|
|
1134
1134
|
};
|
|
1135
|
-
|
|
1135
|
+
_context11.next = 16;
|
|
1136
1136
|
break;
|
|
1137
|
-
case
|
|
1137
|
+
case 14:
|
|
1138
1138
|
if (!(subjectType === "user")) {
|
|
1139
|
-
|
|
1139
|
+
_context11.next = 15;
|
|
1140
1140
|
break;
|
|
1141
1141
|
}
|
|
1142
1142
|
subjectInfo = {
|
|
@@ -1144,23 +1144,23 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
1144
1144
|
oauth_id: subjectId,
|
|
1145
1145
|
type: "oauth_user"
|
|
1146
1146
|
};
|
|
1147
|
-
|
|
1147
|
+
_context11.next = 16;
|
|
1148
1148
|
break;
|
|
1149
|
-
case
|
|
1149
|
+
case 15:
|
|
1150
1150
|
throw Error("Invalid subject type: ".concat(subjectType));
|
|
1151
|
-
case
|
|
1152
|
-
|
|
1151
|
+
case 16:
|
|
1152
|
+
_context11.next = 18;
|
|
1153
1153
|
break;
|
|
1154
|
-
case
|
|
1154
|
+
case 17:
|
|
1155
1155
|
throw Error("Invalid subject source: ".concat(subjectSource));
|
|
1156
|
-
case
|
|
1156
|
+
case 18:
|
|
1157
1157
|
permissionSpec.subject = subjectInfo;
|
|
1158
1158
|
existingPermissions.permissions[index] = permissionSpec;
|
|
1159
1159
|
if (offlineDraft) {
|
|
1160
|
-
|
|
1160
|
+
_context11.next = 19;
|
|
1161
1161
|
break;
|
|
1162
1162
|
}
|
|
1163
|
-
|
|
1163
|
+
_context11.next = 19;
|
|
1164
1164
|
return this.client.ReplaceMetadata({
|
|
1165
1165
|
libraryId: policyLibraryId,
|
|
1166
1166
|
objectId: policyId,
|
|
@@ -1168,9 +1168,9 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
1168
1168
|
metadataSubtree: UrlJoin("auth_policy_spec", itemId, "permissions"),
|
|
1169
1169
|
metadata: existingPermissions.permissions
|
|
1170
1170
|
});
|
|
1171
|
-
case
|
|
1171
|
+
case 19:
|
|
1172
1172
|
if (!(subjectSource === "fabric" && subjectType === "user")) {
|
|
1173
|
-
|
|
1173
|
+
_context11.next = 23;
|
|
1174
1174
|
break;
|
|
1175
1175
|
}
|
|
1176
1176
|
newMeta = {
|
|
@@ -1178,27 +1178,27 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
1178
1178
|
name: subjectName
|
|
1179
1179
|
};
|
|
1180
1180
|
if (!offlineDraft) {
|
|
1181
|
-
|
|
1181
|
+
_context11.next = 20;
|
|
1182
1182
|
break;
|
|
1183
1183
|
}
|
|
1184
1184
|
this.drafts[policyId].meta["auth_policy_settings"]["fabric_users"][this.client.utils.HashToAddress(subjectId)] = newMeta;
|
|
1185
|
-
|
|
1185
|
+
_context11.next = 22;
|
|
1186
1186
|
break;
|
|
1187
|
-
case
|
|
1188
|
-
|
|
1187
|
+
case 20:
|
|
1188
|
+
_context11.next = 21;
|
|
1189
1189
|
return this.client.ContentObjectMetadata({
|
|
1190
1190
|
libraryId: policyLibraryId,
|
|
1191
1191
|
objectId: policyId,
|
|
1192
1192
|
writeToken: policyWriteToken,
|
|
1193
1193
|
metadataSubtree: UrlJoin("auth_policy_settings", "fabric_users", this.client.utils.HashToAddress(subjectId))
|
|
1194
1194
|
});
|
|
1195
|
-
case
|
|
1196
|
-
userInfo =
|
|
1195
|
+
case 21:
|
|
1196
|
+
userInfo = _context11.sent;
|
|
1197
1197
|
if (userInfo) {
|
|
1198
|
-
|
|
1198
|
+
_context11.next = 22;
|
|
1199
1199
|
break;
|
|
1200
1200
|
}
|
|
1201
|
-
|
|
1201
|
+
_context11.next = 22;
|
|
1202
1202
|
return this.client.ReplaceMetadata({
|
|
1203
1203
|
libraryId: policyLibraryId,
|
|
1204
1204
|
objectId: policyId,
|
|
@@ -1206,12 +1206,12 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
1206
1206
|
metadataSubtree: UrlJoin("auth_policy_settings", "fabric_users", this.client.utils.HashToAddress(subjectId)),
|
|
1207
1207
|
metadata: newMeta
|
|
1208
1208
|
});
|
|
1209
|
-
case
|
|
1210
|
-
|
|
1209
|
+
case 22:
|
|
1210
|
+
_context11.next = 26;
|
|
1211
1211
|
break;
|
|
1212
|
-
case
|
|
1212
|
+
case 23:
|
|
1213
1213
|
if (!(subjectSource === "fabric" && subjectType === "ntp")) {
|
|
1214
|
-
|
|
1214
|
+
_context11.next = 26;
|
|
1215
1215
|
break;
|
|
1216
1216
|
}
|
|
1217
1217
|
_newMeta = {
|
|
@@ -1221,27 +1221,27 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
1221
1221
|
type: "ntpInstance"
|
|
1222
1222
|
};
|
|
1223
1223
|
if (!offlineDraft) {
|
|
1224
|
-
|
|
1224
|
+
_context11.next = 24;
|
|
1225
1225
|
break;
|
|
1226
1226
|
}
|
|
1227
1227
|
this.drafts[policyId].meta["auth_policy_settings"]["ntp_instances"][subjectId] = _newMeta;
|
|
1228
|
-
|
|
1228
|
+
_context11.next = 26;
|
|
1229
1229
|
break;
|
|
1230
|
-
case
|
|
1231
|
-
|
|
1230
|
+
case 24:
|
|
1231
|
+
_context11.next = 25;
|
|
1232
1232
|
return this.client.ContentObjectMetadata({
|
|
1233
1233
|
libraryId: policyLibraryId,
|
|
1234
1234
|
objectId: policyId,
|
|
1235
1235
|
writeToken: policyWriteToken,
|
|
1236
1236
|
metadataSubtree: UrlJoin("auth_policy_settings", "ntp_instances", subjectId)
|
|
1237
1237
|
});
|
|
1238
|
-
case
|
|
1239
|
-
_userInfo =
|
|
1238
|
+
case 25:
|
|
1239
|
+
_userInfo = _context11.sent;
|
|
1240
1240
|
if (_userInfo) {
|
|
1241
|
-
|
|
1241
|
+
_context11.next = 26;
|
|
1242
1242
|
break;
|
|
1243
1243
|
}
|
|
1244
|
-
|
|
1244
|
+
_context11.next = 26;
|
|
1245
1245
|
return this.client.ReplaceMetadata({
|
|
1246
1246
|
libraryId: policyLibraryId,
|
|
1247
1247
|
objectId: policyId,
|
|
@@ -1249,13 +1249,13 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
1249
1249
|
metadataSubtree: UrlJoin("auth_policy_settings", "ntp_instances", subjectId),
|
|
1250
1250
|
metadata: _newMeta
|
|
1251
1251
|
});
|
|
1252
|
-
case
|
|
1252
|
+
case 26:
|
|
1253
1253
|
case "end":
|
|
1254
|
-
return
|
|
1254
|
+
return _context11.stop();
|
|
1255
1255
|
}
|
|
1256
|
-
},
|
|
1256
|
+
}, _callee11, this);
|
|
1257
1257
|
}));
|
|
1258
|
-
function SetPermission(
|
|
1258
|
+
function SetPermission(_x11) {
|
|
1259
1259
|
return _SetPermission.apply(this, arguments);
|
|
1260
1260
|
}
|
|
1261
1261
|
return SetPermission;
|
|
@@ -1274,93 +1274,93 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
1274
1274
|
}, {
|
|
1275
1275
|
key: "RemovePermission",
|
|
1276
1276
|
value: (function () {
|
|
1277
|
-
var _RemovePermission = _asyncToGenerator(
|
|
1277
|
+
var _RemovePermission = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref12) {
|
|
1278
1278
|
var _this4 = this;
|
|
1279
|
-
var policyId, policyWriteToken, itemId, subjectId, policyLibraryId, permissions, id;
|
|
1280
|
-
return _regeneratorRuntime.wrap(function
|
|
1281
|
-
while (1) switch (
|
|
1279
|
+
var policyId, policyWriteToken, itemId, subjectId, policyLibraryId, permissions, id, _t63;
|
|
1280
|
+
return _regeneratorRuntime.wrap(function (_context13) {
|
|
1281
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1282
1282
|
case 0:
|
|
1283
|
-
policyId =
|
|
1283
|
+
policyId = _ref12.policyId, policyWriteToken = _ref12.policyWriteToken, itemId = _ref12.itemId, subjectId = _ref12.subjectId;
|
|
1284
1284
|
ValidatePresence("policyId", policyId);
|
|
1285
1285
|
ValidatePresence("policyWriteToken", policyWriteToken);
|
|
1286
1286
|
ValidatePresence("itemId", itemId);
|
|
1287
1287
|
ValidatePresence("subjectId", subjectId);
|
|
1288
|
-
|
|
1288
|
+
_context13.next = 1;
|
|
1289
1289
|
return this.client.ContentObjectLibraryId({
|
|
1290
1290
|
objectId: policyId
|
|
1291
1291
|
});
|
|
1292
|
-
case
|
|
1293
|
-
policyLibraryId =
|
|
1294
|
-
|
|
1292
|
+
case 1:
|
|
1293
|
+
policyLibraryId = _context13.sent;
|
|
1294
|
+
_context13.next = 2;
|
|
1295
1295
|
return this.client.ContentObjectMetadata({
|
|
1296
1296
|
libraryId: policyLibraryId,
|
|
1297
1297
|
objectId: policyId,
|
|
1298
1298
|
writeToken: policyWriteToken,
|
|
1299
1299
|
metadataSubtree: UrlJoin("auth_policy_spec", itemId, "permissions")
|
|
1300
1300
|
});
|
|
1301
|
-
case
|
|
1302
|
-
permissions =
|
|
1301
|
+
case 2:
|
|
1302
|
+
permissions = _context13.sent;
|
|
1303
1303
|
if (permissions) {
|
|
1304
|
-
|
|
1304
|
+
_context13.next = 3;
|
|
1305
1305
|
break;
|
|
1306
1306
|
}
|
|
1307
|
-
return
|
|
1308
|
-
case
|
|
1307
|
+
return _context13.abrupt("return");
|
|
1308
|
+
case 3:
|
|
1309
1309
|
if (!subjectId.startsWith("0x")) {
|
|
1310
|
-
|
|
1310
|
+
_context13.next = 6;
|
|
1311
1311
|
break;
|
|
1312
1312
|
}
|
|
1313
1313
|
id = this.client.utils.AddressToObjectId(subjectId);
|
|
1314
|
-
|
|
1314
|
+
_context13.next = 4;
|
|
1315
1315
|
return this.client.AccessType({
|
|
1316
1316
|
id: id
|
|
1317
1317
|
});
|
|
1318
|
-
case
|
|
1319
|
-
|
|
1320
|
-
if (!(
|
|
1321
|
-
|
|
1318
|
+
case 4:
|
|
1319
|
+
_t63 = _context13.sent;
|
|
1320
|
+
if (!(_t63 === "group")) {
|
|
1321
|
+
_context13.next = 5;
|
|
1322
1322
|
break;
|
|
1323
1323
|
}
|
|
1324
1324
|
subjectId = "igrp".concat(this.client.utils.AddressToHash(subjectId));
|
|
1325
|
-
|
|
1325
|
+
_context13.next = 6;
|
|
1326
1326
|
break;
|
|
1327
|
-
case
|
|
1327
|
+
case 5:
|
|
1328
1328
|
subjectId = "iusr".concat(this.client.utils.AddressToHash(subjectId));
|
|
1329
|
-
case
|
|
1330
|
-
|
|
1331
|
-
return Promise.all(permissions.map(
|
|
1332
|
-
var
|
|
1333
|
-
return _regeneratorRuntime.wrap(function
|
|
1334
|
-
while (1) switch (
|
|
1329
|
+
case 6:
|
|
1330
|
+
_context13.next = 7;
|
|
1331
|
+
return Promise.all(permissions.map(/*#__PURE__*/function () {
|
|
1332
|
+
var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12(permission, index) {
|
|
1333
|
+
return _regeneratorRuntime.wrap(function (_context12) {
|
|
1334
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1335
1335
|
case 0:
|
|
1336
1336
|
if (!(permission.subject.id === subjectId || permission.subject.oauth_id === subjectId)) {
|
|
1337
|
-
|
|
1337
|
+
_context12.next = 1;
|
|
1338
1338
|
break;
|
|
1339
1339
|
}
|
|
1340
|
-
|
|
1340
|
+
_context12.next = 1;
|
|
1341
1341
|
return _this4.client.DeleteMetadata({
|
|
1342
1342
|
libraryId: policyLibraryId,
|
|
1343
1343
|
objectId: policyId,
|
|
1344
1344
|
writeToken: policyWriteToken,
|
|
1345
1345
|
metadataSubtree: UrlJoin("auth_policy_spec", itemId, "permissions", index.toString())
|
|
1346
1346
|
});
|
|
1347
|
-
case
|
|
1347
|
+
case 1:
|
|
1348
1348
|
case "end":
|
|
1349
|
-
return
|
|
1349
|
+
return _context12.stop();
|
|
1350
1350
|
}
|
|
1351
|
-
},
|
|
1351
|
+
}, _callee12);
|
|
1352
1352
|
}));
|
|
1353
|
-
return function (
|
|
1354
|
-
return
|
|
1353
|
+
return function (_x13, _x14) {
|
|
1354
|
+
return _ref13.apply(this, arguments);
|
|
1355
1355
|
};
|
|
1356
1356
|
}()));
|
|
1357
|
-
case
|
|
1357
|
+
case 7:
|
|
1358
1358
|
case "end":
|
|
1359
|
-
return
|
|
1359
|
+
return _context13.stop();
|
|
1360
1360
|
}
|
|
1361
|
-
},
|
|
1361
|
+
}, _callee13, this);
|
|
1362
1362
|
}));
|
|
1363
|
-
function RemovePermission(
|
|
1363
|
+
function RemovePermission(_x12) {
|
|
1364
1364
|
return _RemovePermission.apply(this, arguments);
|
|
1365
1365
|
}
|
|
1366
1366
|
return RemovePermission;
|
|
@@ -1380,108 +1380,108 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
1380
1380
|
}, {
|
|
1381
1381
|
key: "SubjectPermissions",
|
|
1382
1382
|
value: (function () {
|
|
1383
|
-
var _SubjectPermissions = _asyncToGenerator(
|
|
1383
|
+
var _SubjectPermissions = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref14) {
|
|
1384
1384
|
var _this5 = this;
|
|
1385
|
-
var policyId, policyWriteToken, subjectId, id, policyLibraryId, policy, allSubjectPermissions, _i, _Object$keys, itemId, itemPermissions, subjectPermissions;
|
|
1386
|
-
return _regeneratorRuntime.wrap(function
|
|
1387
|
-
while (1) switch (
|
|
1385
|
+
var policyId, policyWriteToken, subjectId, id, policyLibraryId, policy, allSubjectPermissions, _i, _Object$keys, itemId, itemPermissions, subjectPermissions, _t64;
|
|
1386
|
+
return _regeneratorRuntime.wrap(function (_context15) {
|
|
1387
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1388
1388
|
case 0:
|
|
1389
|
-
policyId =
|
|
1389
|
+
policyId = _ref14.policyId, policyWriteToken = _ref14.policyWriteToken, subjectId = _ref14.subjectId;
|
|
1390
1390
|
ValidatePresence("policyId", policyId);
|
|
1391
1391
|
ValidatePresence("subjectId", subjectId);
|
|
1392
1392
|
|
|
1393
1393
|
// Convert address to appropriate ID
|
|
1394
1394
|
if (!subjectId.startsWith("0x")) {
|
|
1395
|
-
|
|
1395
|
+
_context15.next = 3;
|
|
1396
1396
|
break;
|
|
1397
1397
|
}
|
|
1398
1398
|
id = this.client.utils.AddressToObjectId(subjectId);
|
|
1399
|
-
|
|
1399
|
+
_context15.next = 1;
|
|
1400
1400
|
return this.client.AccessType({
|
|
1401
1401
|
id: id
|
|
1402
1402
|
});
|
|
1403
|
-
case
|
|
1404
|
-
|
|
1405
|
-
if (!(
|
|
1406
|
-
|
|
1403
|
+
case 1:
|
|
1404
|
+
_t64 = _context15.sent;
|
|
1405
|
+
if (!(_t64 === "group")) {
|
|
1406
|
+
_context15.next = 2;
|
|
1407
1407
|
break;
|
|
1408
1408
|
}
|
|
1409
1409
|
subjectId = "igrp".concat(this.client.utils.AddressToHash(subjectId));
|
|
1410
|
-
|
|
1410
|
+
_context15.next = 3;
|
|
1411
1411
|
break;
|
|
1412
|
-
case
|
|
1412
|
+
case 2:
|
|
1413
1413
|
subjectId = "iusr".concat(this.client.utils.AddressToHash(subjectId));
|
|
1414
|
-
case
|
|
1415
|
-
|
|
1414
|
+
case 3:
|
|
1415
|
+
_context15.next = 4;
|
|
1416
1416
|
return this.client.ContentObjectLibraryId({
|
|
1417
1417
|
objectId: policyId
|
|
1418
1418
|
});
|
|
1419
|
-
case
|
|
1420
|
-
policyLibraryId =
|
|
1421
|
-
|
|
1419
|
+
case 4:
|
|
1420
|
+
policyLibraryId = _context15.sent;
|
|
1421
|
+
_context15.next = 5;
|
|
1422
1422
|
return this.client.ContentObjectMetadata({
|
|
1423
1423
|
libraryId: policyLibraryId,
|
|
1424
1424
|
objectId: policyId,
|
|
1425
1425
|
writeToken: policyWriteToken,
|
|
1426
1426
|
metadataSubtree: UrlJoin("auth_policy_spec")
|
|
1427
1427
|
});
|
|
1428
|
-
case
|
|
1429
|
-
policy =
|
|
1428
|
+
case 5:
|
|
1429
|
+
policy = _context15.sent;
|
|
1430
1430
|
allSubjectPermissions = {};
|
|
1431
1431
|
_i = 0, _Object$keys = Object.keys(policy);
|
|
1432
|
-
case
|
|
1432
|
+
case 6:
|
|
1433
1433
|
if (!(_i < _Object$keys.length)) {
|
|
1434
|
-
|
|
1434
|
+
_context15.next = 9;
|
|
1435
1435
|
break;
|
|
1436
1436
|
}
|
|
1437
1437
|
itemId = _Object$keys[_i];
|
|
1438
1438
|
itemPermissions = policy[itemId].permissions || [];
|
|
1439
|
-
|
|
1439
|
+
_context15.next = 7;
|
|
1440
1440
|
return Promise.all(itemPermissions.filter(function (permission) {
|
|
1441
1441
|
return (permission.subject || {}).oauth_id === subjectId || (permission.subject || {}).id === subjectId;
|
|
1442
|
-
}).map(
|
|
1443
|
-
var
|
|
1444
|
-
return _regeneratorRuntime.wrap(function
|
|
1445
|
-
while (1) switch (
|
|
1442
|
+
}).map(/*#__PURE__*/function () {
|
|
1443
|
+
var _ref15 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14(permission) {
|
|
1444
|
+
return _regeneratorRuntime.wrap(function (_context14) {
|
|
1445
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1446
1446
|
case 0:
|
|
1447
|
-
|
|
1447
|
+
_context14.next = 1;
|
|
1448
1448
|
return _this5.FormatPermission({
|
|
1449
1449
|
policyId: policyId,
|
|
1450
1450
|
policyWriteToken: policyWriteToken,
|
|
1451
1451
|
permission: permission
|
|
1452
1452
|
});
|
|
1453
|
+
case 1:
|
|
1454
|
+
return _context14.abrupt("return", _context14.sent);
|
|
1453
1455
|
case 2:
|
|
1454
|
-
return _context16.abrupt("return", _context16.sent);
|
|
1455
|
-
case 3:
|
|
1456
1456
|
case "end":
|
|
1457
|
-
return
|
|
1457
|
+
return _context14.stop();
|
|
1458
1458
|
}
|
|
1459
|
-
},
|
|
1459
|
+
}, _callee14);
|
|
1460
1460
|
}));
|
|
1461
|
-
return function (
|
|
1462
|
-
return
|
|
1461
|
+
return function (_x16) {
|
|
1462
|
+
return _ref15.apply(this, arguments);
|
|
1463
1463
|
};
|
|
1464
1464
|
}()));
|
|
1465
|
-
case
|
|
1466
|
-
subjectPermissions =
|
|
1465
|
+
case 7:
|
|
1466
|
+
subjectPermissions = _context15.sent;
|
|
1467
1467
|
if (subjectPermissions.length > 0) {
|
|
1468
1468
|
allSubjectPermissions[itemId] = _objectSpread(_objectSpread({}, policy[itemId]), {}, {
|
|
1469
1469
|
permissions: subjectPermissions
|
|
1470
1470
|
});
|
|
1471
1471
|
}
|
|
1472
|
-
case
|
|
1472
|
+
case 8:
|
|
1473
1473
|
_i++;
|
|
1474
|
-
|
|
1474
|
+
_context15.next = 6;
|
|
1475
1475
|
break;
|
|
1476
|
-
case
|
|
1477
|
-
return
|
|
1478
|
-
case
|
|
1476
|
+
case 9:
|
|
1477
|
+
return _context15.abrupt("return", allSubjectPermissions);
|
|
1478
|
+
case 10:
|
|
1479
1479
|
case "end":
|
|
1480
|
-
return
|
|
1480
|
+
return _context15.stop();
|
|
1481
1481
|
}
|
|
1482
|
-
},
|
|
1482
|
+
}, _callee15, this);
|
|
1483
1483
|
}));
|
|
1484
|
-
function SubjectPermissions(
|
|
1484
|
+
function SubjectPermissions(_x15) {
|
|
1485
1485
|
return _SubjectPermissions.apply(this, arguments);
|
|
1486
1486
|
}
|
|
1487
1487
|
return SubjectPermissions;
|
|
@@ -1499,54 +1499,54 @@ var PermissionsClient = /*#__PURE__*/function () {
|
|
|
1499
1499
|
}, {
|
|
1500
1500
|
key: "RemoveSubjectPermissions",
|
|
1501
1501
|
value: (function () {
|
|
1502
|
-
var _RemoveSubjectPermissions = _asyncToGenerator(
|
|
1502
|
+
var _RemoveSubjectPermissions = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref16) {
|
|
1503
1503
|
var _this6 = this;
|
|
1504
1504
|
var policyId, policyWriteToken, subjectId, subjectPermissions;
|
|
1505
|
-
return _regeneratorRuntime.wrap(function
|
|
1506
|
-
while (1) switch (
|
|
1505
|
+
return _regeneratorRuntime.wrap(function (_context17) {
|
|
1506
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1507
1507
|
case 0:
|
|
1508
|
-
policyId =
|
|
1508
|
+
policyId = _ref16.policyId, policyWriteToken = _ref16.policyWriteToken, subjectId = _ref16.subjectId;
|
|
1509
1509
|
ValidatePresence("policyId", policyId);
|
|
1510
1510
|
ValidatePresence("policyWriteToken", policyWriteToken);
|
|
1511
1511
|
ValidatePresence("subjectId", subjectId);
|
|
1512
|
-
|
|
1512
|
+
_context17.next = 1;
|
|
1513
1513
|
return this.SubjectPermissions({
|
|
1514
1514
|
policyId: policyId,
|
|
1515
1515
|
policyWriteToken: policyWriteToken,
|
|
1516
1516
|
subjectId: subjectId
|
|
1517
1517
|
});
|
|
1518
|
-
case
|
|
1519
|
-
subjectPermissions =
|
|
1520
|
-
|
|
1518
|
+
case 1:
|
|
1519
|
+
subjectPermissions = _context17.sent;
|
|
1520
|
+
_context17.next = 2;
|
|
1521
1521
|
return this.client.utils.LimitedMap(5, Object.keys(subjectPermissions), /*#__PURE__*/function () {
|
|
1522
|
-
var
|
|
1523
|
-
return _regeneratorRuntime.wrap(function
|
|
1524
|
-
while (1) switch (
|
|
1522
|
+
var _ref17 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee16(itemId) {
|
|
1523
|
+
return _regeneratorRuntime.wrap(function (_context16) {
|
|
1524
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1525
1525
|
case 0:
|
|
1526
|
-
|
|
1526
|
+
_context16.next = 1;
|
|
1527
1527
|
return _this6.RemovePermission({
|
|
1528
1528
|
policyId: policyId,
|
|
1529
1529
|
policyWriteToken: policyWriteToken,
|
|
1530
1530
|
subjectId: subjectId,
|
|
1531
1531
|
itemId: itemId
|
|
1532
1532
|
});
|
|
1533
|
-
case
|
|
1533
|
+
case 1:
|
|
1534
1534
|
case "end":
|
|
1535
|
-
return
|
|
1535
|
+
return _context16.stop();
|
|
1536
1536
|
}
|
|
1537
|
-
},
|
|
1537
|
+
}, _callee16);
|
|
1538
1538
|
}));
|
|
1539
|
-
return function (
|
|
1540
|
-
return
|
|
1539
|
+
return function (_x18) {
|
|
1540
|
+
return _ref17.apply(this, arguments);
|
|
1541
1541
|
};
|
|
1542
1542
|
}());
|
|
1543
|
-
case
|
|
1543
|
+
case 2:
|
|
1544
1544
|
case "end":
|
|
1545
|
-
return
|
|
1545
|
+
return _context17.stop();
|
|
1546
1546
|
}
|
|
1547
|
-
},
|
|
1547
|
+
}, _callee17, this);
|
|
1548
1548
|
}));
|
|
1549
|
-
function RemoveSubjectPermissions(
|
|
1549
|
+
function RemoveSubjectPermissions(_x17) {
|
|
1550
1550
|
return _RemoveSubjectPermissions.apply(this, arguments);
|
|
1551
1551
|
}
|
|
1552
1552
|
return RemoveSubjectPermissions;
|