Cies
08/21/2024, 7:21 PM@RequiresAnyUserPermissionOf(...)
that takes one or more permission enum instances. We check on each incoming request that that user user is allowed to the action by using reflection to get the annotation of the method and the class and all superclasses (up to some point). I consider caching all this by making some maps like Map<KFunction<Result>, List<Permission>>
and Map<KClass<Controller>, List<Permission>>
so it is all cached and we do not have to (recursively) reflect all over the place to now what permissions are on a certain controller class or controller action method.
I have no clue what a KClass or KFunction actually is! Would this be a good idea? Or should I make these maps based on string representations (and the convert the KFunction or KClass to a string when doing a lookup)? Or doing a bunch of these reflections class to find the annotations soooooo fast that I should not bother at all... Just curious what you have to say on this, and as to how a KFunction or KClass actually is represented in memory.Cies
08/22/2024, 8:32 AMhashCode
and equals
show me enough of the internals to know that this approach of caching in a HashMap based on KFunction
keys should work