In my Play application, I’ve added Secure module. But I haven’t found a way to check user profile in views. For example, one of the possible roles is “admin”. When viewing certain pages, a button should be visible to admin’s only. How to do that?
My first idea was to check session variable but I found nothing there. Security object is not available in views. Then I thought about putting data in there by overriding onAuthenticated method in my authentification controller, but I’m not sure that is the best way to proceed.
What do you think?
If you have your own security module that extends controller.secure.Security, then within your view you can do this: