See the light - agile, industrial strength, rapid web application development made easy

(Quick Reference) # 7.3.3 Logical Tags - Reference Documentation Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith, Lari Hotari Version: 2.3.8 ## 7.3.3 Logical Tags You can also create logical tags where the body of the tag is only output once a set of conditions have been met. An example of this may be a set of security tags:
    def isAdmin = { attrs, body ->
        def user = attrs.user
        if (user && checkUserPrivs(user)) {
            out << body()
        }
    }
The tag above checks if the user is an administrator and only outputs the body content if he/she has the correct set of access privileges:
    <g:isAdmin user="${myUser}">
        // some restricted content
    </g:isAdmin>
| Quick Reference (hide)