Plugin development. Overriding existing behaviour

pauliusnfq
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 14, 2020

Hello,

I'm developing a plugin that would allow to hide/show time tracking with a custom permission. I managed to add the custom permission in my atlassian-plugin.xml. 

<project-permission key="VIEW_WORKLOGS"
i18n-name-key="admin.permissions.VIEW_WORKLOGS"
i18n-description-key="admin.permissions.descriptions.VIEW_WORKLOGS"
category="TIME_TRACKING" />

Now the problem is how should I modify the code to check the permission. I found that com.atlassian.jira.bc.issue.worklog.TimeTrackingConfiguration.PropertiesAdaptor class has an enabled method that tells if time tracking should be enabled (shown). I would like to override this class and provide my own implementation that would also check if the user has the custom permission. I tried to override the class using  https://bitbucket.org/atlassian/atlassian-spring-scanner/src but the original class would still be used instead of the new one.

@ExportAsService({com.atlassian.jira.bc.issue.worklog.TimeTrackingConfiguration.class})
@Named("timeTrackingConfiguration")
public class Test extends com.atlassian.jira.bc.issue.worklog.TimeTrackingConfiguration.PropertiesAdaptor

Maybe there are other ways to achieve this?

0 answers

Suggest an answer

Log in or Sign up to answer