@esri/arcgis-rest-portal 4.0.3 → 4.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundled/portal.esm.js +17 -9
- package/dist/bundled/portal.esm.js.map +1 -1
- package/dist/bundled/portal.esm.min.js +3 -3
- package/dist/bundled/portal.esm.min.js.map +1 -1
- package/dist/bundled/portal.umd.js +17 -9
- package/dist/bundled/portal.umd.js.map +1 -1
- package/dist/bundled/portal.umd.min.js +3 -3
- package/dist/bundled/portal.umd.min.js.map +1 -1
- package/dist/cjs/helpers.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/sharing/helpers.js.map +1 -1
- package/dist/cjs/sharing/share-item-with-group.js +7 -4
- package/dist/cjs/sharing/share-item-with-group.js.map +1 -1
- package/dist/cjs/util/generic-search.js +7 -2
- package/dist/cjs/util/generic-search.js.map +1 -1
- package/dist/cjs/util/get-portal.js +1 -1
- package/dist/cjs/util/get-portal.js.map +1 -1
- package/dist/cjs/util/get-subscription-info.js +1 -1
- package/dist/cjs/util/get-subscription-info.js.map +1 -1
- package/dist/cjs/util/scrub-control-chars.js.map +1 -1
- package/dist/cjs/util/search.js.map +1 -1
- package/dist/esm/helpers.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/sharing/helpers.js.map +1 -1
- package/dist/esm/sharing/share-item-with-group.js +7 -4
- package/dist/esm/sharing/share-item-with-group.js.map +1 -1
- package/dist/esm/util/generic-search.js +7 -2
- package/dist/esm/util/generic-search.js.map +1 -1
- package/dist/esm/util/get-portal.d.ts +1 -1
- package/dist/esm/util/get-portal.js +1 -1
- package/dist/esm/util/get-portal.js.map +1 -1
- package/dist/esm/util/get-subscription-info.d.ts +1 -1
- package/dist/esm/util/get-subscription-info.js +1 -1
- package/dist/esm/util/get-subscription-info.js.map +1 -1
- package/dist/esm/util/scrub-control-chars.js.map +1 -1
- package/dist/esm/util/search.d.ts +10 -0
- package/dist/esm/util/search.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/arcgis-rest-portal - v4.0.
|
|
2
|
+
* @esri/arcgis-rest-portal - v4.0.4 - Apache-2.0
|
|
3
3
|
* Copyright (c) 2017-2022 Esri, Inc.
|
|
4
|
-
*
|
|
4
|
+
* Thu Sep 15 2022 20:30:23 GMT+0000 (Coordinated Universal Time)
|
|
5
5
|
*/
|
|
6
6
|
import { cleanUrl, request, appendCustomParams, warn } from '@esri/arcgis-rest-request';
|
|
7
7
|
|
|
@@ -1351,7 +1351,7 @@ function genericSearch(search, searchType) {
|
|
|
1351
1351
|
};
|
|
1352
1352
|
}
|
|
1353
1353
|
else {
|
|
1354
|
-
// searchUserAccess has one (
|
|
1354
|
+
// searchUserAccess has one (known) valid value: "groupMember"
|
|
1355
1355
|
options = appendCustomParams(search, [
|
|
1356
1356
|
"q",
|
|
1357
1357
|
"num",
|
|
@@ -1359,7 +1359,12 @@ function genericSearch(search, searchType) {
|
|
|
1359
1359
|
"sortField",
|
|
1360
1360
|
"sortOrder",
|
|
1361
1361
|
"searchUserAccess",
|
|
1362
|
-
"searchUserName"
|
|
1362
|
+
"searchUserName",
|
|
1363
|
+
"filter",
|
|
1364
|
+
"countFields",
|
|
1365
|
+
"countSize",
|
|
1366
|
+
"categories",
|
|
1367
|
+
"categoryFilters"
|
|
1363
1368
|
], {
|
|
1364
1369
|
httpMethod: "GET"
|
|
1365
1370
|
});
|
|
@@ -2422,6 +2427,8 @@ function shareItemWithGroup(requestOptions) {
|
|
|
2422
2427
|
if (itemOwner !== username) {
|
|
2423
2428
|
// need to track if the user is an admin
|
|
2424
2429
|
let isAdmin = false;
|
|
2430
|
+
// track if the admin & owner are in the same org
|
|
2431
|
+
let isCrossOrgSharing = false;
|
|
2425
2432
|
// next perform any necessary membership adjustments for
|
|
2426
2433
|
// current user and/or item owner
|
|
2427
2434
|
return Promise.all([
|
|
@@ -2438,6 +2445,7 @@ function shareItemWithGroup(requestOptions) {
|
|
|
2438
2445
|
.then(([currentUser, ownerUser, membership]) => {
|
|
2439
2446
|
const isSharedEditingGroup = !!confirmItemControl;
|
|
2440
2447
|
isAdmin = currentUser.role === "org_admin" && !currentUser.roleId;
|
|
2448
|
+
isCrossOrgSharing = currentUser.orgId !== ownerUser.orgId;
|
|
2441
2449
|
return getMembershipAdjustments(currentUser, isSharedEditingGroup, membership, isAdmin, ownerUser, requestOptions);
|
|
2442
2450
|
})
|
|
2443
2451
|
.then((membershipAdjustments) => {
|
|
@@ -2451,7 +2459,7 @@ function shareItemWithGroup(requestOptions) {
|
|
|
2451
2459
|
return Promise.all(membershipAdjustments.map(({ promise }) => promise))
|
|
2452
2460
|
.then(() => {
|
|
2453
2461
|
// then attempt the share
|
|
2454
|
-
return shareToGroup(requestOptions, isAdmin);
|
|
2462
|
+
return shareToGroup(requestOptions, isAdmin, isCrossOrgSharing);
|
|
2455
2463
|
})
|
|
2456
2464
|
.then((sharingResults) => {
|
|
2457
2465
|
// lastly, if the admin user was added to the group,
|
|
@@ -2502,7 +2510,7 @@ function getMembershipAdjustments(currentUser, isSharedEditingGroup, membership,
|
|
|
2502
2510
|
}
|
|
2503
2511
|
return membershipGuarantees;
|
|
2504
2512
|
}
|
|
2505
|
-
function shareToGroup(requestOptions, isAdmin = false) {
|
|
2513
|
+
function shareToGroup(requestOptions, isAdmin = false, isCrossOrgSharing = false) {
|
|
2506
2514
|
const username = requestOptions.authentication.username;
|
|
2507
2515
|
const itemOwner = requestOptions.owner || username;
|
|
2508
2516
|
// decide what url to use
|
|
@@ -2510,8 +2518,8 @@ function shareToGroup(requestOptions, isAdmin = false) {
|
|
|
2510
2518
|
let url = `${getPortalUrl(requestOptions)}/content/items/${requestOptions.id}/share`;
|
|
2511
2519
|
// but if they are the owner, or org_admin, use this route
|
|
2512
2520
|
// Note: When using this end-point as an admin, apparently the admin does not need to be a member of the group (the itemOwner does)
|
|
2513
|
-
//
|
|
2514
|
-
if (itemOwner === username || isAdmin) {
|
|
2521
|
+
// Note: Admin's can only use this route when the item is in the same org they are admin for
|
|
2522
|
+
if (itemOwner === username || (isAdmin && !isCrossOrgSharing)) {
|
|
2515
2523
|
url = `${getPortalUrl(requestOptions)}/content/users/${itemOwner}/items/${requestOptions.id}/share`;
|
|
2516
2524
|
}
|
|
2517
2525
|
// now its finally time to do the sharing
|
|
@@ -2766,7 +2774,7 @@ function getSelf(requestOptions) {
|
|
|
2766
2774
|
* If you intend to request a portal by id and it is different from the portal specified by options.authentication, you must also pass options.portal.
|
|
2767
2775
|
*
|
|
2768
2776
|
* ```js
|
|
2769
|
-
* import { getPortal } from "@esri/arcgis-rest-
|
|
2777
|
+
* import { getPortal } from "@esri/arcgis-rest-portal";
|
|
2770
2778
|
* //
|
|
2771
2779
|
* getPortal()
|
|
2772
2780
|
* getPortal("fe8")
|