How to use the @esri/arcgis-rest-portal.getUser 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 / arcgis-rest-js / demos / webmap-checker-sapper / src / userInfoMiddleware.js View on Github external
export function userInfoMiddleware(incomingRequest, outgoingResponse, next) {
  if (incomingRequest.session && incomingRequest.session.userSession) {
    Promise.all([
      getUser({ authentication: incomingRequest.session.userSession }),
      getSelf({ authentication: incomingRequest.session.userSession })
    ]).then(([userInfo, orgInfo]) => {
      // add information to the request so the next middleware can access it
      incomingRequest.session.userInfo = userInfo;
      incomingRequest.session.orgInfo = orgInfo;
      next(); // run the next middleware
    });
  } else {
    next(); // run the next middleware
  }
}
github roemhildtg / vscode-arcgis-assistant / src / lib / PortalConnection.ts View on Github external
public async getGroups() : Promise {
        await this.authenticate();
        return getUser({
            username: this.authentication.username,
            authentication: this.authentication,
            portal: this.restURL,
        }).then(user => user.groups || []);
    }