Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to add conditions (UserLoggedIn and UserIsAdmin) on Web-item?

Tayyab Bashir
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 7, 2016

Hi, 
In my plugin I want to add following conditions on web-item:

  1. It should only be displayed to logged in users.
  2. It should only be displayed to Admin user groups. 

I'm doing the following but the plugin doesnt work.
Although I got these conditions from the API, but they seem to be erroneous.  

<web-item name="My Links" i18n-name-key="my-links.name" key="my-links" section="system.top.navigation.bar" weight="1000">
    <description key="my-links.description">The Links Plugin</description>
    <label key="my-links.label"></label>
    <link linkId="my-links-link">https://www.google.com</link>
    <condition class="com.atlassian.jira.plugin.webfragment.conditions.UserLoggedInCondition" />
    <condition class="com.atlassian.jira.plugin.webfragment.conditions.UserIsAdminCondition"/>
  </web-item>

Can you tell me how to do this? 

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Nelson Carranza
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 8, 2016

Hi Muhammad,

It looks like UserLoggedInCondition  is part of jira-core and not jira-api.

Try adding JIRA core in your pom see below.

<dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-core</artifactId>
            <version>${jira.version}</version>
            <scope>provided</scope>
        </dependency>

Regards

Nelson

Tayyab Bashir
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 13, 2016

Yes, that worked. Thanks :)

1 vote
Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 7, 2016

Hi Muhammad,

You need to wrap the conditions into the conditions tag with type AND:

<conditions type="AND">
  <condition class="com.atlassian.jira.plugin.webfragment.conditions.UserLoggedInCondition" />
  <condition class="com.atlassian.jira.plugin.webfragment.conditions.UserIsAdminCondition"/>
</conditions>
Tayyab Bashir
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 8, 2016

No still not working :/

TAGS
AUG Leaders

Atlassian Community Events