# Web-panels conditions

**URL:** <https://community.developer.atlassian.com/t/web-panels-conditions/52721>\
**Category:** Jira Cloud\
**Tags:** jira-cloud\
**Created:** [October 8, 2021, 11:29am UTC](https://community.developer.atlassian.com/t/web-panels-conditions/52721 "2021-10-08T11:29:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![PiotrSobieraj](https://avatars.discourse-cdn.com/v4/letter/p/dbc845/32.png) [@PiotrSobieraj](https://community.developer.atlassian.com/u/PiotrSobieraj)\
**Post date:** [October 8, 2021, 11:29am UTC](https://community.developer.atlassian.com/t/web-panels-conditions/52721/1 "2021-10-08T11:29:02Z")

</div>

Hi!

Currently, we are implementing additional web panels in Jira and we want to disable them for users which don’t have permission to do these functions based on user groups.

Therefore in your documentation, we found information about conditions that should be applied to each web-panels in the atlassian-connect.json file. And we want to use this condition: “entity\_property\_contains\_any\_user\_group” but it won’t work.

We found this information in these two docs:  
[https://developer.atlassian.com/cloud/confluence/connect-conditions/#property-conditions](https://developer.atlassian.com/cloud/confluence/connect-conditions/#property-conditions)  
[https://developer.atlassian.com/cloud/jira/platform/connect-conditions/](https://developer.atlassian.com/cloud/jira/platform/connect-conditions/)

Our syntax for this condition looks like this:

```auto
"condition": "entity_property_contains_any_user_group",
"params": {
"entity": "user",
"propertyKey": "groups",
"objectName": "[\"example-group\"]"
}

```

In this case, if we swap"example-group" with a proper user group panel is disabled but it should be enabled. In addition, we found in your docs that to access user groups it is necessary to add parameter expand, and in this case, the request looks that “/user?accountId={user.accountId}&expand=groups”. Maybe we should pass something similar into our entity?

Example user entity looks that:

```auto
{
"self": "url",
"accountId": "id",
"accountType": "atlassian",
"avatarUrls": {
"48x48": "url",
"24x24": "url",
"16x16": "url",
"32x32": "url"
},
"displayName": "Name",
"active": true,
"timeZone": "Europe/Warsaw",
"locale": "en_GB",
"groups": {
"size": 1,
"items": []
},
"applicationRoles": {
"size": 3,
"items": []
},
"expand": "groups,applicationRoles"
}

```

We found such a solution [Solution](https://community.developer.atlassian.com/t/app-descriptor-condition-to-control-app-menu/42889) but it would be a great help if you can indicate how looks proper syntax for this case or indicate another solution to cope with that.

Regards,  
Peter

---

<div class="post-metadata">

**Author:** ![danielwester](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/danielwester/32/36730_2.png) [@danielwester](https://community.developer.atlassian.com/u/danielwester)\
**Post date:** [October 8, 2021, 12:48pm UTC](https://community.developer.atlassian.com/t/web-panels-conditions/52721/2 "2021-10-08T12:48:03Z")

</div>

Don’t use entity properties to store permission related configuration. Any user that can modify the entity itself can modify the properties (in your case - the user can craft some js and add themselves to the group).

You should take a look at [https://developer.atlassian.com/cloud/jira/platform/modules/global-permission/](https://developer.atlassian.com/cloud/jira/platform/modules/global-permission/) or [https://developer.atlassian.com/cloud/jira/platform/modules/project-permission/](https://developer.atlassian.com/cloud/jira/platform/modules/project-permission/)

from there you can make use of the has\_global\_permission or has\_project\_permission condition.

---

<div class="post-metadata">

**Author:** ![PiotrSobieraj](https://avatars.discourse-cdn.com/v4/letter/p/dbc845/32.png) [@PiotrSobieraj](https://community.developer.atlassian.com/u/PiotrSobieraj)\
**Post date:** [October 8, 2021, 1:35pm UTC](https://community.developer.atlassian.com/t/web-panels-conditions/52721/4 "2021-10-08T13:35:02Z")

</div>

Many thanks for Your reply. The solution you proposed makes sense.

In my case, I have about five web panels and all of them have different permission rules. Therefore in this case which you suggest is it possible to define in global permissions separate permissions for each of them? If yes is it possible to define them in separate files and can You give me a specific example of the define permission rule?

Thanks in advance,  
Peter

---

<div class="post-metadata">

**Author:** ![danielwester](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/danielwester/32/36730_2.png) [@danielwester](https://community.developer.atlassian.com/u/danielwester)\
**Post date:** [October 8, 2021, 1:41pm UTC](https://community.developer.atlassian.com/t/web-panels-conditions/52721/5 "2021-10-08T13:41:51Z")

</div>

In your descriptor you can do something like:

```auto

    "jiraGlobalPermissions": [
      {
        "description": {
          "value": "Description here"
        },
        "anonymousAllowed": false,
        "defaultGrants": [
          "all"
        ],
        "name": {
          "value": "Some permission name"
        },
        "key": "my-special-permission"
      }

```

Then in each panel:

```auto
 "conditions": [
          {
            "condition": "has_global_permission",
            "params": {
            "permission": "my-app-key__my-special-permission"
            }
          }
]

```

where my-app-key is the app key.

---

<div class="post-metadata">

**Author:** ![PiotrSobieraj](https://avatars.discourse-cdn.com/v4/letter/p/dbc845/32.png) [@PiotrSobieraj](https://community.developer.atlassian.com/u/PiotrSobieraj)\
**Post date:** [October 11, 2021, 7:49am UTC](https://community.developer.atlassian.com/t/web-panels-conditions/52721/6 "2021-10-11T07:49:58Z")

</div>

Many thanks for Your reply. Now it’s more clear but still, I don’t understand some matters in the example that you have given.

First: `"key": "my-special-permission"` where can I define “my-special-permission” and that can have a block of conditions in JSON file? Can I give in this place path to my conditions?  
Second:` "permission": "my-app-key__my-special-permission"` in this case `"my-app-key"` can be a key name of first element in my additional web panel e.x. `"first-web-element"`?

Thanks in advance,  
Peter
