I am starting to develop a GWT application in MVP style (GWTP) and which uses Spring security for authentication and authorization on server side.
In many views of the application, I have to enable or disable controls with respect to a granted authority of the current user. I already have an RPC service which provides access to a userDetailsDto containing all the necessary information.
Now my question: What is the best place to store the user DTO on client side?
Since the user rights are relevant in many presenters, I would have to pass it around everywhere. Alternatively, I could set an RPC service instance in every presenter and requets the user details each time (probably cached on client-side). But i don't like the idea of having a user RPC service in each presenter just for this purpose.
To be honest, I'd rather would prefer a central registry where to put the UserDetails object and which is accessable from anywhere in my app. Is there already such a registry in GWT?
As in my example, you might often be confronted with horizontally used objects. How to deal with them in GWT?
Simply store your current user in public static variable. It will be accessible from everywhere.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With