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

ClassCastException for Strings within grouping fucntions #254

Closed
pza94 opened this issue Feb 9, 2022 · 3 comments
Closed

ClassCastException for Strings within grouping fucntions #254

pza94 opened this issue Feb 9, 2022 · 3 comments
Assignees
Labels

Comments

@pza94
Copy link

pza94 commented Feb 9, 2022

Hi there,

I created a matcher that extracts a string from a given request object, and checks if that is in a given group:

g4(keyGet2(r.obj, "/customer/:cid/*", "cid"), p.dom )

When I try to call enforce it throws a ClassCastException.

java.lang.ClassCastException: <String, > is not a javaType

	at com.googlecode.aviator.runtime.function.FunctionUtils.getJavaObject(FunctionUtils.java:107)
	at org.casbin.jcasbin.util.BuiltInFunctions$1.variadicCall(BuiltInFunctions.java:354)
	at com.googlecode.aviator.runtime.function.AbstractVariadicFunction.call(AbstractVariadicFunction.java:71)
	at Script_1644402524748_59/70807318.execute0(Script_1644402524748_59:1)
	at com.googlecode.aviator.ClassExpression.executeDirectly(ClassExpression.java:44)
	at com.googlecode.aviator.BaseExpression.execute(BaseExpression.java:237)
	at org.casbin.jcasbin.main.CoreEnforcer.enforce(CoreEnforcer.java:478)
	at org.casbin.jcasbin.main.CoreEnforcer.enforce(CoreEnforcer.java:590)
	at com.w.platform.rbac.MCEnforcer.enforce(MCEnforcer.java:95)

I made some investigation myself, I found that the g(rouping)-function expects that the arguments are AviatorJavaObjects (fx. p.dom) and just fails when it receives a raw string. But keyGet2 returns string so it feels that it is impossible to use keyGet2 within a group match function.

PS. the exact same configuration: same policies, groups, model, request works as intended in the online editor, https://casbin.org/en/editor/

@casbin-bot
Copy link
Member

@hsluoyz
Copy link
Member

hsluoyz commented Feb 9, 2022

@tangyang9464
Copy link
Member

@hsluoyz @pza94 soloved by #265

@hsluoyz hsluoyz added bug and removed question labels May 15, 2022
@hsluoyz hsluoyz closed this as completed May 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants