Export User Role Mappings

After an application is shared or deployed, any changes you make to user roles in that scope are updated directly in the application's IDCS environment. These updates are no longer copied to your application's user-roles.json file. If you want the role mappings in IDCS saved to your application's sources, you'll need to export the information from IDCS to your user-roles.json file.

When you first create user roles and map those roles to IDCS groups, the role mappings are stored in the application's sources, as part of the user-roles.json file. These initial role mappings (defined as the application's defaultMapping in user-roles.json) are automatically propagated to IDCS when you first share or deploy your application. After the application is shared or deployed (usually, with a version in the URL), any changes you make to your role mappings go directly to IDCS. As a result, the user-roles.json file in your application's sources won't be in sync with your changes in IDCS.

Does this matter? Yes, because the role-mapping information in user-roles.json is used as the source for many operations, for example, when a teammate clones your Git repository to create a new workspace. Because user-roles.json doesn't have the latest IDCS changes, the file versioned in Git also doesn't have these updates. Consequently, the new workspace that is cloned from Git won't have the most up-to-date role mappings.

Stale information can also affect role mappings when you deploy your app to a different URL after changing its root URL in Settings—but deployments to the same URL, both with or without a version, won't be impacted. In other words, the defaultMapping in user-roles.json is used only when an app is shared or deployed for the first time or when it is deployed afresh to a different URL.

Any time you change an application's role mapping after the app is shared or deployed, you can export the role mapping from IDCS and refresh the defaultMapping in user-roles.json. You can do this at the level of your application's three scopes: when it is shared from your workspace, when it is deployed with a version in its URL, and when it is deployed live to production.

Once you refresh the source file and push the updated file to Git, all new deployments will include the updated role-mapping information from IDCS. So will any new workspaces created from branches with the refreshed role mappings.

To export role mappings from IDCS to your source file:

  1. In the visual application's header, click the Menu option in the upper right corner.
  2. Click Settings.
  3. In the Settings editor, click the User Roles tab.
  4. Select a scope in the Export Mappings to Source drop-down list. Your selection determines which role-mapping definition in IDCS is pulled into your application's source file:
    • Select Workspace to export the role mappings defined for shared versions of the application.
    • Select Deployed with version in URL to export the role mappings for application versions deployed with a version in the URL.
    • Select Deployed to export the role mappings for the live version of the deployed application.
    • Select All to export role mappings defined in all scopes.


    A confirmation message appears after the mappings are exported.
  5. Click Source View in the Navigator, then select user-roles.json under settings.
  6. Check the file's defaultMapping section to review the role mappings copied from IDCS to the source file.
  7. Commit and push the changed user-roles.json file to the project's Git repository, just as you would any other changed file. See Manage Your Visual Application With Git.