Documentation

Conditions

A condition specifies requirements that must be met for a user to access the features or UI exposed by a module. For instance, the condition can require a user to be an administrator, have edit permissions, and apply other requirements for access. If the condition is not met, the panel, page, or other UI element exposed by the add-on does not appear on the page.

Various types of modules accept conditions, including generalPages, adminPages, and webItems. To see whether a certain module accepts conditions, see their specific module documentation page.

Remote Conditions

{
    "name": "My Addon",
    "modules": {
        "generalPages": [
            {
                "conditions": [
                    {
                        "condition": "/condition/onlyBettyCondition"
                    }
                ]
            }
        ]
    }
}

For a remote condition, the Atlassian application issues a request to the remote resource and expects a response which specifies whether to show or hide the module feature.

{
    "shouldDisplay": false
}

The add-on can pass parameters to the remote condition as URL query parameters. Remote condition has request authentication information passed through as a header, rather than as a query string parameter.

Static conditions

A static condition is a condition which is exposed from the host Atlassian application.

For example, a condition that will evaluate when only anonymous users view the page is specified by the following module declaration:

{
    "name": "My Addon",
    "modules": {
        "generalPages": [
            {
                "conditions": [
                    {
                        "condition": "user_is_logged_in",
                        "invert": true
                    }
                ]
            }
        ]
    }
}

Condition parameters

Certain static conditions also accept parameters. For example:

  • has_issue_permission
  • has_project_permission

These conditions restrict access to the modules based upon user permission settings for the issue or project. Note that behind the scenes, the issue permission check simply checks the project context for the issue and conducts the permission check for the user against that project.

You can pass parameters to conditions as follows:

{
    "name": "My Addon",
    "modules": {
        "generalPages": [
            {
                "conditions": [
                    {
                        "condition": "has_issue_permission",
                        "invert": false,
                        "params": {
                            "permission": "resolv"
                        }
                    }
                ]
            }
        ]
    }
}

In this case, the user must have not just access to the issue but resolve permissions specifically. The permissions applicable to Atlassian Connect JIRA add-on modules are equivalent to those applicable to JIRA Java plugin development, as described in the JIRA Permissions class reference documentation. The following section describes the mapping of [JIRA permissions] to the permissions you can use in the Atlassian Connect add-on descriptor.

JIRA condition parameter mappings

The following table shows the condition parameters available for has_issue_permission and has_project_permission in Atlassian Connect module declarations and how they map to the permissions described in the Permissions class documentation.

JIRA condition parametersAtlassian Connect equivalent
ADMINISTERadmin
USEuse
SYSTEM_ADMINsysadmin
PROJECT_ADMINproject
BROWSEbrowse
CREATE_ISSUEcreate
EDIT_ISSUEedit
EDIT_ISSUEupdate
SCHEDULE_ISSUEscheduleissue
ASSIGNABLE_USERassignable
ASSIGN_ISSUEassign
RESOLVE_ISSUEresolv
CLOSE_ISSUEclose
WORKLOG_EDIT_ALLworklogeditall
WORKLOG_EDIT_OWNworklogeditown
WORKLOG_DELETE_OWNworklogdeleteown
WORKLOG_DELETE_ALLworklogdeleteall
WORK_ISSUEwork
LINK_ISSUElink
DELETE_ISSUEdelete
CREATE_SHARED_OBJECTSsharefilters
MANAGE_GROUP_FILTER_SUBSCRIPTIONSgroupsubscriptions
MOVE_ISSUEmove
SET_ISSUE_SECURITYsetsecurity
USER_PICKERpickusers
VIEW_VERSION_CONTROLviewversioncontrol
MODIFY_REPORTERmodifyreporter
VIEW_VOTERS_AND_WATCHERSviewvotersandwatchers
MANAGE_WATCHER_LISTmanagewatcherlist
BULK_CHANGEbulkchange
COMMENT_EDIT_ALLcommenteditall
COMMENT_EDIT_OWNcommenteditown
COMMENT_DELETE_OWNcommentdeleteown
COMMENT_DELETE_ALLcommentdeleteall
ATTACHMENT_DELETE_OWNattachdeleteown
ATTACHMENT_DELETE_ALLattachdeleteall
CREATE_ATTACHMENTattach
COMMENT_ISSUEcomment
VIEW_WORKFLOW_READONLYviewworkflowreadonly

JIRA conditions

  • browse_users_permission
  • can_attach_file_to_issue
  • can_attach_screenshot_to_issue
  • can_convert_to_issue
  • can_convert_to_sub_task
  • can_create_shared_objects
  • can_manage_attachments
  • external_user_management_disabled
  • has_issue_permission
  • has_link_types_available
  • has_project_permission
  • has_selected_project
  • has_sub_tasks_available
  • has_voted_for_issue
  • is_admin_mode
  • is_field_hidden
  • is_issue_assigned_to_current_user
  • is_issue_editable
  • is_issue_unresolved
  • is_keyboard_shortcuts_enabled
  • is_sub_task
  • is_watching_issue
  • linking_enabled
  • not_version_context
  • smtp_mail_server_configured
  • sub_tasks_enabled
  • time_tracking_enabled
  • user_has_issue_history
  • user_is_admin
  • user_is_logged_in
  • user_is_project_admin
  • user_is_sysadmin
  • user_is_the_logged_in_user
  • voting_enabled
  • watching_enabled

Confluence Conditions

  • active_theme
  • can_cluster
  • can_edit_space_styles
  • can_signup
  • content_has_any_permissions_set
  • create_content
  • email_address_public
  • favourite_page
  • favourite_space
  • following_target_user
  • has_attachment
  • has_blog_post
  • has_page
  • has_space
  • has_template
  • latest_version
  • not_personal_space
  • printable_version
  • showing_page_attachments
  • space_function_permission
  • target_user_can_set_status
  • target_user_has_personal_blog
  • target_user_has_personal_space
  • threaded_comments
  • tiny_url_supported
  • user_can_create_personal_space
  • user_can_update_user_status
  • user_can_use_confluence
  • user_favouriting_target_user_personal_space
  • user_has_personal_blog
  • user_has_personal_space
  • user_is_confluence_administrator
  • user_is_logged_in
  • user_is_sysadmin
  • user_logged_in_editable
  • user_watching_page
  • user_watching_space
  • user_watching_space_for_content_type
  • viewing_content
  • viewing_own_profile
  • writable_directory_exists