@esri/arcgis-rest-portal 4.0.1 → 4.0.4
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 +10 -7
- 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 +10 -7
- 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/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/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.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/arcgis-rest-portal - v4.0.
|
|
2
|
+
* @esri/arcgis-rest-portal - v4.0.3 - Apache-2.0
|
|
3
3
|
* Copyright (c) 2017-2022 Esri, Inc.
|
|
4
|
-
* Mon
|
|
4
|
+
* Mon Aug 22 2022 19:56:33 GMT+0000 (Coordinated Universal Time)
|
|
5
5
|
*/
|
|
6
6
|
import { cleanUrl, request, appendCustomParams, warn } from '@esri/arcgis-rest-request';
|
|
7
7
|
|
|
@@ -2422,6 +2422,8 @@ function shareItemWithGroup(requestOptions) {
|
|
|
2422
2422
|
if (itemOwner !== username) {
|
|
2423
2423
|
// need to track if the user is an admin
|
|
2424
2424
|
let isAdmin = false;
|
|
2425
|
+
// track if the admin & owner are in the same org
|
|
2426
|
+
let isCrossOrgSharing = false;
|
|
2425
2427
|
// next perform any necessary membership adjustments for
|
|
2426
2428
|
// current user and/or item owner
|
|
2427
2429
|
return Promise.all([
|
|
@@ -2438,6 +2440,7 @@ function shareItemWithGroup(requestOptions) {
|
|
|
2438
2440
|
.then(([currentUser, ownerUser, membership]) => {
|
|
2439
2441
|
const isSharedEditingGroup = !!confirmItemControl;
|
|
2440
2442
|
isAdmin = currentUser.role === "org_admin" && !currentUser.roleId;
|
|
2443
|
+
isCrossOrgSharing = currentUser.orgId !== ownerUser.orgId;
|
|
2441
2444
|
return getMembershipAdjustments(currentUser, isSharedEditingGroup, membership, isAdmin, ownerUser, requestOptions);
|
|
2442
2445
|
})
|
|
2443
2446
|
.then((membershipAdjustments) => {
|
|
@@ -2451,7 +2454,7 @@ function shareItemWithGroup(requestOptions) {
|
|
|
2451
2454
|
return Promise.all(membershipAdjustments.map(({ promise }) => promise))
|
|
2452
2455
|
.then(() => {
|
|
2453
2456
|
// then attempt the share
|
|
2454
|
-
return shareToGroup(requestOptions, isAdmin);
|
|
2457
|
+
return shareToGroup(requestOptions, isAdmin, isCrossOrgSharing);
|
|
2455
2458
|
})
|
|
2456
2459
|
.then((sharingResults) => {
|
|
2457
2460
|
// lastly, if the admin user was added to the group,
|
|
@@ -2502,7 +2505,7 @@ function getMembershipAdjustments(currentUser, isSharedEditingGroup, membership,
|
|
|
2502
2505
|
}
|
|
2503
2506
|
return membershipGuarantees;
|
|
2504
2507
|
}
|
|
2505
|
-
function shareToGroup(requestOptions, isAdmin = false) {
|
|
2508
|
+
function shareToGroup(requestOptions, isAdmin = false, isCrossOrgSharing = false) {
|
|
2506
2509
|
const username = requestOptions.authentication.username;
|
|
2507
2510
|
const itemOwner = requestOptions.owner || username;
|
|
2508
2511
|
// decide what url to use
|
|
@@ -2510,8 +2513,8 @@ function shareToGroup(requestOptions, isAdmin = false) {
|
|
|
2510
2513
|
let url = `${getPortalUrl(requestOptions)}/content/items/${requestOptions.id}/share`;
|
|
2511
2514
|
// but if they are the owner, or org_admin, use this route
|
|
2512
2515
|
// 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) {
|
|
2516
|
+
// Note: Admin's can only use this route when the item is in the same org they are admin for
|
|
2517
|
+
if (itemOwner === username || (isAdmin && !isCrossOrgSharing)) {
|
|
2515
2518
|
url = `${getPortalUrl(requestOptions)}/content/users/${itemOwner}/items/${requestOptions.id}/share`;
|
|
2516
2519
|
}
|
|
2517
2520
|
// now its finally time to do the sharing
|
|
@@ -2766,7 +2769,7 @@ function getSelf(requestOptions) {
|
|
|
2766
2769
|
* 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
2770
|
*
|
|
2768
2771
|
* ```js
|
|
2769
|
-
* import { getPortal } from "@esri/arcgis-rest-
|
|
2772
|
+
* import { getPortal } from "@esri/arcgis-rest-portal";
|
|
2770
2773
|
* //
|
|
2771
2774
|
* getPortal()
|
|
2772
2775
|
* getPortal("fe8")
|