summaryrefslogtreecommitdiffstats
path: root/idrop-web/grails-app/taglib
diff options
context:
space:
mode:
authormconway <michael.c.conway@gmail.com>2013-02-18 21:14:38 (GMT)
committer mconway <michael.c.conway@gmail.com>2013-02-18 21:14:38 (GMT)
commite84e25d4e59d97033b4aa505ebb5d271fa9b8ea8 (patch)
tree524ebf99a407d641e8a0add5ca84cc1fe93151f3 /idrop-web/grails-app/taglib
parenta0b1644912dcc14325344b3e988b0c27d146d32a (diff)
downloadQCG-Data-e84e25d4e59d97033b4aa505ebb5d271fa9b8ea8.zip
QCG-Data-e84e25d4e59d97033b4aa505ebb5d271fa9b8ea8.tar.gz
QCG-Data-e84e25d4e59d97033b4aa505ebb5d271fa9b8ea8.tar.bz2
[#1157] fix ticket landing pages and error pages
Diffstat (limited to 'idrop-web/grails-app/taglib')
-rwxr-xr-xidrop-web/grails-app/taglib/org/irods/mydrop/taglib/AuthTagLib.groovy26
1 files changed, 26 insertions, 0 deletions
diff --git a/idrop-web/grails-app/taglib/org/irods/mydrop/taglib/AuthTagLib.groovy b/idrop-web/grails-app/taglib/org/irods/mydrop/taglib/AuthTagLib.groovy
index 10cc81f..24f1754 100755
--- a/idrop-web/grails-app/taglib/org/irods/mydrop/taglib/AuthTagLib.groovy
+++ b/idrop-web/grails-app/taglib/org/irods/mydrop/taglib/AuthTagLib.groovy
@@ -1,5 +1,7 @@
package org.irods.mydrop.taglib
+import org.irods.jargon.core.connection.IRODSAccount
+
class AuthTagLib {
private boolean isAuthenticated() {
@@ -9,6 +11,30 @@ class AuthTagLib {
return auth != null
}
+ private boolean isGuestAccount() {
+ //auth = session.SPRING_SECURITY_CONTEXT?.authentication?.authenticated
+ IRODSAccount auth = (IRODSAccount) session["SPRING_SECURITY_CONTEXT"]
+ if (auth == null) {
+ return false
+ }
+ //log.info("auth is: ${auth}")
+ return auth.anonymousAccount
+ }
+
+
+ /**
+ * Tag will return true if this is not a guest account, handy for preventing the display
+ * of things that only a real user should be able to get to, such as profile stuff
+ */
+ def ifNotGuestAccount = { attrs, body ->
+
+ if (!isGuestAccount()) {
+ out << body()
+ }
+
+ }
+
+
def ifAuthenticated = { attrs, body ->
if (isAuthenticated()) {