Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional logic for a web-item plugin

Tarun Arora November 4, 2013

<web-item key="vacCalendar_link" name="Vacation Calendar" section="my_links_link/my_links_section" weight="10">
<label>Vacation Calendar</label>
<link linkId="vacCalendar_link">javascript:void(window.open('http://10.75.9.179:8081/quickr/faces/vacationCalendar.xhtml?loggedInUser=$authcontext.loggedInUser.name','test','width=800, height=800'));
</link>
</web-item>

I have added the above web-item plugin in atlassian-plugin.xml

I have another requirement now :

If the logged in user is a developer on click of the above link i want that he should be able to access URL1 but if the logged in user is a Project Manager/Lead he should be able to access URL2.

I am aware that any custom condition can be written by making our java class extend the com.atlassian.jira.plugin.webfragment.conditions.AbstractJiraCondition.But how do i mention links based on the condition.

Regards

Tarun

1 answer

1 accepted

1 vote
Answer accepted
Boris Georgiev [Appfire]
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.
November 4, 2013

You just have to create two <web-item> elements and each of them will have different condition. The web-items will be the same except the condition and the link. When the user is a developer he'll see the first web-item and the second will not be rendered as its condition will not match, and if the user is project manager/lead he'll see the second web-item and the first will not be rendered.

I think you'll have to create your own condition to check if the user is a developer or project lead. See here for more information on how to define and use the conditionhttps://developer.atlassian.com/display/DOCS/Web+Item+Plugin+Module#WebItemPluginModule-ConditionandConditionsElements

Tarun Arora November 4, 2013

Thanks for your help Boris...You are a genious...:)

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, aafp, jira migration, marketing collaboration, end siloed work, streamline workflows, kerrie gottschalk, jira cloud admins, unified marketing, process visibility, team efficiency, cross-team collaboration

How Kerrie Gottschalk unified AAFP’s marketing team with Jira

At the American Academy of Family Physicians, siloed marketing teams faced delays and duplicate work. Kerrie Gottschalk shook things up by moving the department to Jira, streamlining processes, boosting visibility, and sparking stronger collaboration.

Read the story
AUG Leaders

Atlassian Community Events