Hi There,
I am trying to add the below condition into WebItem element in atlassian-plugin.xml:
com.atlassian.jira.plugin.webfragment.conditions.UserHasVisibleProjectsCondition
I got an error when I start up Jira, “org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.atlassian.jira.security.PermissionManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency.”
When I use condition “com.atlassian.jira.plugin.webfragment.conditions.UserLoggedInCondition” instead, it works correctly. It seems that there is no class called PermissionManager in package com.atlassian.jira.security.
Can anybody throw some light on this?
Thanks,
Bob
Hi Bob,
actually there is PermissionManager interface (and several implementation class of this interface) in com.atlassian.jira.security package.
Compare constructor of class UserLoggedInCondition and UserHasVisibleProjectsCondition (Check it for your Jira version). For UserLoggedInCondition, there is no parameter in constructor, but for UserHasVisibleProjectsCondition one parameter (PermissionManager) is required.
I checked web condition documentation Web Condition and I don’t think it’s possible to pass an instance via atlassian-plugin.xml.
Therefore I suggest to you define your own condition class with no parameters constructor, get an instance of PermissionManager interface, create instance of UserHasVisibleProjectsCondition and use instance of UserHasVisibleProjectsCondition in shouldDisplay method to check given permission.
Let me know if it’s helpful for you.
Kind Regards
Josef Pavelec, at MoroSystems s.r.o., Czech Republic
Hi Josef,
Thank you for your reply.
In fact, I had added the parameter inside the UserHasVisibleProjectsCondition as We panel document suggests below but the error is the same.
project
I was wondering if the parameter is wrong (“project” should not be used). Or, I have to create one new class by myself to implement UserHasVisibleProjectsCondition with/without parameter.
Regards,
Bob