How to get current_user by using Spring Security Grails plugin in GSP

后端 未结 4 1009
花落未央
花落未央 2021-01-13 13:42

I am newbie in Grails. I am using Spring Security Grails plugin for Authentication purpose. I want to get current user in my view gsp file.

I am trying like this ..

4条回答
  •  日久生厌
    2021-01-13 14:23

    It looks like, the existing tags, which are part of Spring Security plugin are not sufficient for you, correct? See: http://grails-plugins.github.io/grails-spring-security-core/docs/manual/guide/6%20Helper%20Classes.html#6.1%20SecurityTagLib

    My advice is to add a new method to the Person entity, which takes a Post as an argument and returns true/false, if it can be edited (or vise versa add new method to Post entity, which takes Person as an argument, this is up to your decision).

    You can then create your own tag, which utilizes this method, makes your GPS nicer, even if it is not a mandatory step.

提交回复
热议问题