Confluence Connect conditional display of menu items

Hi there,

We used to store app settings in app properties.
Now we changed the way, how we store the settings, and use the content properties of a private space to store the settings.

We also used to have display conditions for a menuItem, e.g.:

{
  ...,
  "location": "system.content.action/modify",
  "conditions": [
    {
      "condition": "user_is_logged_in"
    },
    {
      "or": [
        {
          "and": [
            {
              "condition": "entity_property_equal_to",
              "invert": true,
              "params": {
                "entity": "addon",
                "propertyKey": "configuration",
                "objectName": "showMenuItem",
                "value": "Never"
              }
            },
            {
              "condition": "entity_property_equal_to",
              "invert": true,
              "params": {
                "entity": "addon",
                "propertyKey": "configuration",
                "objectName": "showMenuItem",
                "value": "Admins"
              }
            }
          ]
        },...
      ]
    }
  ]
}

Since we changed those settings, it isn’t possible to check for the content property this way.
Is there an option, where we can check for content properties on specific spaces? e.g.:

{
  "condition": "entity_property_equal_to",
  "invert": true,
  "params": {
    "entity": "space",
    "key": "CONFIGURATIONSPACE",
    "propertyKey": "configuration",
    "objectName": "showMenuItem",
    "value": "Never"
  }
}

I know there is the possibility to check for content properties on a space, but afaik, it’s only possible to check for the content properties on the current space.


In the Confluence Server Version, it was possible to add custom conditions, like this:

<web-item name="name"
          key="pkey"
          section="system.content.action/modify"
          weight="10">
    ...
    <conditions type="AND">
        <condition class="....util.ContextMenuIconCondition"/>
        ...
    </conditions>
</web-item>

Now, since we are currently implementing all the missing features in the cloud version of our apps, I’m curious, if there’s any possibility to achieve something like the custom conditions in the server version.

A condition where we can define a rest endpoint, which decides whether or not a menuItem should be displayed would be nice.

Hi @BennyJoeVilliger , it doesn’t look like there’s an option for this based on the documentation.

How about using app-properties instead?

Awesome
Thanks for responding

AriesTriputranto

Pada tanggal Jum, 24 Jun 2022 00.27, Engin Tekin via The Atlassian Developer Community <notifications@atlassiandeveloper.discoursemail.com> menulis:

I’ve recently stopped using this condition in one scenario, due to a bug [AC-2554] - Ecosystem Jira

1 Like

Hi @EnginTekin

Thank you for your answer.

How about using app-properties instead?

As I mentioned, we went away from app-properties, to store the settings in a private space. The reason for this is, that the app-properties aren’t secure enough to store our settings.
App properties are being able to be changed by any confluence user, by using the api - At least, I’m sure that it was at some point. We actually had to pay for a bugcrowd incident because of this.
Here is also a good explanation: How to secure access to add-on properties
I’m not sure, if this is fixed by now, since the post is from 2020.

Anyway, by using a private space to store the settings, we are sure, that only admins can mess with the app configuration.

1 Like