How to show or hide specific sections or pages for certain users using displayConditions in Forge manifest?

Hi Community,

Is it possible to show or hide a specific section or page in the navigation (for example, inside a jira:globalPage module) for certain users or based on a custom role, using displayConditions in the Forge manifest?

For example, is something like this supported or planned?

jira:globalPage:

  • key: my-manager
    title: “Manager”
    sections:
    • header: “Admin Stuff”
      displayConditions:
      user: [user1, user2, user3]
      pages:
      • title: “Confidential”
        route: confidential

Or is it only possible to use isAdmin or similar conditions at the module level?
Are there recommended ways to allow only certain users or roles to see some sections/pages directly via the manifest, without doing it in frontend code?

It’s already possible to set displayCondition for Jira global pages. You can check based on the options.

@SaifAyashi you can only achieve that via display logic in the front-end code.

If you only want certain users to access certain data or functionality, you should implement that functionality in a resolver function guarded by an appropriate authorisation check.

Hope this helps!

cheers,
Tim

Hello there,

As I gather from your response I also need to go about with making changes to my display logic in front-end for what I want to achieve @tpettersen yet I wanted to double check.

Perhaps what I’m looking for is slightly different compared to SaifAyashi’s.
Could anyone take a look at the snippet from my manifest file and correct me if I’m doing something wrong here?

    jira:globalPermission:
    - key: "view-global-page"
      name: "Allow view global page"
      description: "This permission allows viewing of the app global page."
      anonymousAllowed: false
      defaultGrants:
        - "jira-administrators"

    jira:globalPage:
    - key: global-page-key
      resource: uikit-index
      render: "native"
      resolver:
        function: handlers
      title: Conditional Global Page
      icon: resource:icons;global-icon.svg
      # This bit here worked, it allows or prevents displaying the whole section.
      # displayConditions:
        # hasGlobalPermission: view-global-page
      sections:
        - pages:
            - key: conditional-page
              title:
                i18n: conditional-title
              route: /conditional-page
              icon: resource:icons;conditional-page-icon.svg
              # This displayCondition bit doesn't seem to have
              # any effect when placed at the page level
              displayConditions:
                hasGlobalPermission: view-global-page
            - key: public-page
              title:
                i18n: public-title
              route: /public-page
              icon: resource:icons;public-page-icon.svg

Thank you in advance, and have a great day.