How to use the @esri/arcgis-rest-portal.setItemAccess function in @esri/arcgis-rest-portal

To help you get started, we’ve selected a few @esri/arcgis-rest-portal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Esri / solution.js / packages / common / src / restHelpers.ts View on Github external
() => {
        if (access && access !== "private") {
          // Set access if it is not AGOL default
          // Set the access manually since the access value in createItem appears to be ignored
          const accessOptions: portal.ISetAccessOptions = {
            id: serviceItemId,
            access: access === "public" ? "public" : "org", // need to use constants rather than string
            authentication: authentication
          };
          portal.setItemAccess(accessOptions).then(
            () => {
              progressTickCallback && progressTickCallback();
              resolve();
            },
            e => reject(generalHelpers.fail(e))
          );
        } else {
          progressTickCallback && progressTickCallback();
          resolve();
        }
      },
      e => reject(generalHelpers.fail(e))
github Esri / solution.js / packages / common / src / restHelpers.ts View on Github external
createResponse => {
        if (createResponse.success) {
          let accessDef: Promise;

          // Set access if it is not AGOL default
          // Set the access manually since the access value in createItem appears to be ignored
          // Need to run serially; will not work reliably if done in parallel with adding the data section
          if (access !== "private") {
            const accessOptions: portal.ISetAccessOptions = {
              id: createResponse.id,
              access: access === "public" ? "public" : "org", // need to use constants rather than string
              authentication: authentication
            };
            accessDef = portal.setItemAccess(accessOptions);
          } else {
            accessDef = Promise.resolve({
              itemId: createResponse.id
            } as portal.ISharingResponse);
          }

          // Now add attached items
          accessDef.then(
            () => {
              const updateDefs: Array> = [];

              // Add the data section
              if (dataFile) {
                updateDefs.push(
                  _addItemDataFile(createResponse.id, dataFile, authentication)
                );
github Esri / ember-arcgis-portal-services / addon / services / sharing-service.js View on Github external
setAccess (owner, itemId, access = null, portalOpts) {
    if (access === 'everyone') {
      access = 'public';
    }

    const args = this.addOptions({
      id: itemId,
      owner,
      access,
    }, portalOpts);

    return setItemAccess(args)
    .catch(handleError);
  },
  /**