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

No unique bean of type [com.atlassian.confluence.security.PermissionHelper] is defined

Bastian Kippelt
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.
October 11, 2015

I want to check if a user has view permission for a page or attachment. I use the PermissionHelper and get this Error:

com.atlassian.confluence.content.render.xhtml.XhtmlException: RuntimeException occurred while performing an XHTML storage transformation (Error creating bean with name '....': Unsatisfied dependency expressed through constructor argument with index 4 of type [com.atlassian.confluence.security.PermissionHelper]: : No unique bean of type [com.atlassian.confluence.security.PermissionHelper] is defined: Unsatisfied dependency of type [class com.atlassian.confluence.security.PermissionHelper]: expected at least 1 matching bean; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.atlassian.confluence.security.PermissionHelper] is defined: Unsatisfied dependency of type [class com.atlassian.confluence.security.PermissionHelper]: expected at least 1 matching bean)

 

private PermissionHelper permissionHelper;
public TestManager(PermissionHelper permissionHelper) {
    this.permissionHelper = permissionHelper;
}
 
public void test() {
if (permissionHelper.canView(user, page)) {
 // do something
}
}

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
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.
October 11, 2015

Did you try to add component import into atlassian-plugin.xml

 

Bastian Kippelt
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.
October 11, 2015

Thanks. This helped. But now i use the PermissionManager.

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.
October 11, 2015

Not at all :-). Just noticed that PermissionHelper is a class and not interface so it can not be imported through component-import. Removed wrong xml snipped.

0 votes
Bastian Kippelt
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.
October 11, 2015

Okay. PermissionManager is the right class to use.

if (permissionManager.hasPermission(user, Permission.VIEW, page)) {
    // do something
}
TAGS
AUG Leaders

Atlassian Community Events