authentication - Defining controller accessible variables from filters in Grails -


I am writing a small webf in Grails, and to ensure that all users are certified, I am using:

  class login filter {static filter = {login login (controller: '*', verb: '*') {before = {if (session.user_id) {request .user = User.get (Session.user_id)} and if (ActionName.equals ("Login")) {Redirect (Administrator: "Login", Action: "Login") Return False}}}}}  

and follow all the admin steps Vocabulary begins with reading the user's property:

  def operation name = {def user = request.user ...}  

above the code Works, but instead of avoiding the duplicate code in all the controlling methods, would it be possible to tie the user object in a variable named "user.fair" rather than "request.user", which would be accessible from all controllers?

I understand that there can be problems that make this impossible, but Grails framework is capable of making some magic under the hood, so I thought it could be worth asking.

Itemprop = "text" {interferator} = {user = request.user} def index = {text: "index: $ {user}"}} def test = {render text: "exam: $ {user}"}} }