If you’re using Deadbolt to provide authorisation support for your Play! app, you need to be aware that DeadboltHandler#getRoleHolder() can potentially be called a lot due to the template tags. A rule of thumb is that for every #{restrict} or #{restrictedResource} tag in your template, getRoleHolder() will be invoked once. If you’re hitting the database to get the user every time, this can have a huge impact on your performance.

Since it’s likely that the your RoleHolder won’t change within a request, you should consider adding the RoleHolder instance to the request argument if you’re not already storing it for the lifespan of the request!

Leave a Reply

Your email address will not be published. Required fields are marked *