Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle array/list of user roles in a single method on User? #102

Closed
tmulle opened this issue Feb 26, 2023 · 3 comments
Closed

How to handle array/list of user roles in a single method on User? #102

tmulle opened this issue Feb 26, 2023 · 3 comments

Comments

@tmulle
Copy link

tmulle commented Feb 26, 2023

Hi,

I have a method on my User class which is a RenardeUser, etc.

I have a method called hasUserRole(String... roleNames) that I'd like to pass in a list of roles to check from my Qute templates in a single method call instead of multiple calls.

This works IF I pass in a list of roles like {#if inject:user && inject:user.hasUserRole("webadmin", "admin", "support")} but I get an exception during RUNTIME if I try to pass in a single value, ie. {#if inject:user && inject:user.hasUserRole("admin")}

The project compiles and starts up just fine but dies when I access the page with the single permission check.

Any ideas?

2023-02-26 17:27:11,348 ERROR [org.jbo.res.rea.com.cor.AbstractResteasyReactiveContext] (executor-thread-1) Request failed: java.lang.ClassCastException: class java.lang.String cannot be cast to class [Ljava.lang.String; (java.lang.String and [Ljava.lang.String; are in module java.base of loader 'bootstrap')
@FroMage
Copy link
Contributor

FroMage commented Feb 27, 2023

This appears to be a bug in Qute, no @mkouba ?

@mkouba
Copy link

mkouba commented Feb 27, 2023

Yes, looks like a bug in vargs processing. Pls file a new issue in https://github.com/quarkusio/quarkus/issues.

@FroMage
Copy link
Contributor

FroMage commented Feb 27, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants