Java API - how to check the create issue permissions for the user on Jira Service desk

Team,

I am able to verify the user is having CREAE_ISSUE permission on jira software but no on the Jira Service Desk.
b = permissionManager.hasPermission(CREAE_ISSUE, project, applicationUser);

Could you please advice me on jira api?

If the user you are checking is a customer, you need to execute the permission check via the CustomerContextService

1 Like

Thanks for your time. Sure let me check.

Hi @anon19873023,

I am facing issue that CustomerContextService is working when I inject to my class.

Usecase:

My plugin basically on the postfunction. so this post function can be used on service desk projects as well. this CustomerContextService class works fine to verify the permissions against to customers. But the new problem I noticed, code is breaking, if there is no service desk application installed to system.

In this case I am not able to load the classes dynamically. generally I do
ComponentAccessor.getComponent(CustomerContextService.class). this method returns null.

I appreciate all your opinions and suggestions.

Thanks,

If you are building a server app you cannot guarantee that JSD will always be installed, therefore your code needs to work in the absence of JSD. If a JSD project exists but JSD is not installed, I am not sure what you would do in that situation, permission checks will probably fail.

There are lots of quirks to JSD permissions for customers etc, where possible you should use the JSD specific API’s for issue creation/comment etc, this will save you a lot of headaches.

In terms of handling the presence/absence of JSD at runtime, there are various ways of doing that, I suggest raising a more specific question in the community if you need help with that.

1 Like

Thanks for your time. I will do that.