Maximo

 View Only

 Get on MOBILE the SITEs I have access to

Sergio Vela's profile image
Sergio Vela posted Fri May 30, 2025 10:41 AM

On mobile, we can switch between SITEs, and these SITEs should be stored in a variable when the application initializes. I'd like to know which variable this is, because I’ve read something about profileOptions, but I can't find anything

Maycon Belfort's profile image
Maycon Belfort IBM Champion

You may find it in this.app.client.userInfo

I don't think you'll find a list of all sites the user has access to, but if you're using different security groups per site, you can view the security groups. That object is similar to /maximo/oslc/whoami response. You can check it by opening it in your browser after logging in to Maximo.

Sergio Vela's profile image
Sergio Vela

In the applicationInitialized method, I added this: console.log(`AppCustomizations (applicationInitialized) Userinfo: ${JSON.stringify(this.app.client.userInfo)}`);
but I don't see anything about the security groups I have access to.

Maycon Belfort's profile image
Maycon Belfort IBM Champion

Apologies, Sergio. You're right. You can see the modules and applications you have access to, but not security groups.

If you have security groups for individual sites, you can create a data source for MAXUSER with a relationship to the user group table. In your pageResumed function in AppCustomizations.js, you can do something like this:

pageResumed(page, app) {
    this.app = app;
    this.page = page;

    if (this.page.name === 'schedule' && this.app.state.allowsites=== undefined) {
      this._checkAllowedSites().then((check) => {
          this.app.log('checkAllowedSites', check);
      });
}

async _checkAllowedSites() {
    const userDS = this.app.findDatasource('userDS');
    await userDS .initializeQbe();
    userDS .setQBE('userid', '=', this.app.userInfo.userName); // MAS
    const user = await userDS .searchQBE();

    // get a list of your sites with the relationship

    this.app.state.allowsites= list || undefined;
    return this.app.state.allowsites;
  }

Hopefully, this can help you.

Cheers,

Maycon

Sergio Vela's profile image
Sergio Vela

Good morning, Maycon.

I've implemented something similar to what you posted.

I found the following in the documentation:

This list of SITEs is received from the server upon application startup and saved in the profileOptions variable in the AppController.js file, but I can't find a way to use it in an application's AppCustomizations.

The solution we have and the one you gave me work, but I didn't want to run more queries to avoid a performance penalty.

But this works for me.

Thank you very much for your help.