Groovy Documentation

taglib
Class SecurityTagLib

java.lang.Object
  taglib.SecurityTagLib

class SecurityTagLib

Property Summary
def canRead

This tag only writes its body to the output if the current user has a permission to read, given attributes of the wiki, and either the directory part of the page path, or the page path e.g.

def canReadAndWrite

This tag only writes its body to the output if the current user has a permission to read and write, given attributes of the wiki, and either the directory part of the page path, or the page path e.g.

static Map conf

def hasPermission

This tag only writes its body to the output if the current user has a permission, given attributes of actions (a comma, space or semicolon separated list), the wiki, and either the directory part of the page path, or the page path e.g.

def isAdministrator

This tag only writes its body to the output if the user has the administrator role

def isNotLoggingIn

This tag only writes its body to the output if the user is not logging in, i.e. not on the login page.

def isServer

This tag only writes its body to the output if we are in server mode

def isWorkstation

This tag only writes its body to the output if we are in workstation mode

def lacksPermission

This tag only writes its body to the output if the current user does not have a permission, given the same attributes as for hasPermission

static def namespace

def principal

Outputs the string form of the current user's identity.

def securityService

 
Constructor Summary
SecurityTagLib()

 
Method Summary
private boolean checkPermission(def tagName, def attrs)

Checks whether the current user has the permission specified in the given tag attributes of actions and page map.

 
Methods inherited from class Object
wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll
 

Property Detail

canRead

def canRead

This tag only writes its body to the output if the current user has a permission to read, given attributes of the wiki, and either the directory part of the page path, or the page path e.g.:

<cow:canRead wiki="${thisPage.wiki.id}"
                         pagePathDir="${thisPage.pagePathDir}>...

or,

<cow:canRead wiki="${thisPage.wiki.id}"
                         pagePath="${thisPage.pagePath}>...

Permission to read is defined by all the actions JsecActionList of name 'Read'


canReadAndWrite

def canReadAndWrite

This tag only writes its body to the output if the current user has a permission to read and write, given attributes of the wiki, and either the directory part of the page path, or the page path e.g.:

<cow:canReadAndWrite wiki="${thisPage.wiki.id}"
                                 pagePathDir="${thisPage.pagePathDir}>...

or,

<cow:canReadAndWrite wiki="${thisPage.wiki.id}"
                                 pagePath="${thisPage.pagePath}>...

Permission to read and write is defined by all the actions JsecActionList of name 'ReadOrWrite'


conf

static Map conf


hasPermission

def hasPermission

This tag only writes its body to the output if the current user has a permission, given attributes of actions (a comma, space or semicolon separated list), the wiki, and either the directory part of the page path, or the page path e.g.:

<cow:hasPermission wiki="${thisPage.wiki.id}"
                               actions="edit"
                               pagePathDir="${thisPage.pagePathDir}>...

or,

<cow:hasPermission wiki="${thisPage.wiki.id}"
                               actions="edit"
                               pagePath="${thisPage.pagePath}>...


isAdministrator

def isAdministrator
This tag only writes its body to the output if the user has the administrator role


isNotLoggingIn

def isNotLoggingIn
This tag only writes its body to the output if the user is not logging in, i.e. not on the login page.


isServer

def isServer
This tag only writes its body to the output if we are in server mode


isWorkstation

def isWorkstation
This tag only writes its body to the output if we are in workstation mode


lacksPermission

def lacksPermission
This tag only writes its body to the output if the current user does not have a permission, given the same attributes as for hasPermission


namespace

static def namespace


principal

def principal

Outputs the string form of the current user's identity. By default this assumes that the subject has only one principal; its string representation is written to the page.

This is a near-copy of the principal tag in the jsecurity plugin, only this version fixes a security vulnerability, by encoding the output as html. This tag may be removed once this vulnerability has been fixed in the jsecurity taglib itself. See jira http://jira.codehaus.org/browse/GRAILSPLUGINS-657 Optional attributes:


securityService

def securityService


 
Constructor Detail

SecurityTagLib

SecurityTagLib()


 
Method Detail

checkPermission

private boolean checkPermission(def tagName, def attrs)
Checks whether the current user has the permission specified in the given tag attributes of actions and page map. Returns true if the we are in workstation mode or the user has the permission, otherwise false.


 

Groovy Documentation