diff options
author | Mike Conway <mikeconway@dhcp152-54-6-70.wireless.europa.renci.org> | 2011-02-17 14:38:21 (GMT) |
---|---|---|
committer | Mike Conway <mikeconway@dhcp152-54-6-70.wireless.europa.renci.org> | 2011-02-17 14:38:21 (GMT) |
commit | a15b1277ccd81614e16bc162008f143a33a6c9ff (patch) | |
tree | 522610618401268ca10fc427ca0f8b7d83bb2b02 /idrop-web/grails-app/taglib | |
parent | d9704159770f7393245bc8020aa7386747255df1 (diff) | |
download | QCG-Data-a15b1277ccd81614e16bc162008f143a33a6c9ff.zip QCG-Data-a15b1277ccd81614e16bc162008f143a33a6c9ff.tar.gz QCG-Data-a15b1277ccd81614e16bc162008f143a33a6c9ff.tar.bz2 |
add tag cloud to web view
Diffstat (limited to 'idrop-web/grails-app/taglib')
-rw-r--r-- | idrop-web/grails-app/taglib/AuthTagLib.groovy | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/idrop-web/grails-app/taglib/AuthTagLib.groovy b/idrop-web/grails-app/taglib/AuthTagLib.groovy new file mode 100644 index 0000000..fee2283 --- /dev/null +++ b/idrop-web/grails-app/taglib/AuthTagLib.groovy @@ -0,0 +1,26 @@ + +import org.springframework.security.core.context.SecurityContextHolder + +class AuthTagLib { + + private boolean isAuthenticated() { + //auth = session.SPRING_SECURITY_CONTEXT?.authentication?.authenticated + def auth = session["SPRING_SECURITY_CONTEXT"] + //log.info("auth is: ${auth}") + return auth != null + } + + + def ifAuthenticated = { attrs, body -> + if (isAuthenticated()) { + out << body() + } + } + + def ifNotAuthenticated = { attrs, body -> + if (!isAuthenticated()) { + out << body() + } + } + +} |