AlabLan opened a new pull request, #522:
URL: https://github.com/apache/casbin-jcasbin/pull/522
## Summary
Added the keyGet3 function to jcasbin for the `{var}` placeholder style,
which was previously only available in the Go version.
## Problem
The documentation at https://casbin.apache.org/docs/function shows keyGet3
function, but jcasbin only implemented keyGet and keyGet2.
## Implementation
- Added KeyGet3Func wrapper class
- Added keyGet3Func implementation in BuiltInFunctions
- Registered keyGet3 in FunctionMap
- Added comprehensive tests ported from Go's TestKeyGet3
## Note on Go/Java Regex Incompatibility
The following Go test cases fail in Java due to regex engine differences:
- testKeyGet3("/{id/using/myresid", "/{id/using/{resId}", "resId",
"myresid")
- testKeyGet3("/{id/using/myresid/status}", "/{id/using/{resId}/status}",
"resId", "myresid")
- testKeyGet3("/api/group1_group_name/project1_admin/info",
"/api/{proj}_admin/info", "proj", "")
Java treats `{` as a repetition quantifier modifier, so patterns like
"/{id/using/(" are invalid. The Java implementation adds escaping for remaining
`{` and `}` characters after the key replacement to
handle this incompatibility.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]