Groovy Documentation

org.grails.plugin.platform.security
[Groovy] Interface SecurityBridge


interface SecurityBridge

Interface that plugin must implement to provide security information


Method Summary
java.util.Map createLink(java.lang.String action)

Create a link to the specified security action

java.lang.String getProviderName()

Implementations must return the name of their security provider

java.lang.String getUserIdentity()

Get user id string i.e.

java.lang.Object getUserInfo()

Get user info object containing i.e. email address, other stuff defined by the security implementation

boolean userExists(java.lang.Object identity)

Determine whether a user with the given id already exists or not

boolean userHasRole(java.lang.Object role)

Return true if the current logged in user has the specified role

boolean userIsAllowed(java.lang.Object object, java.lang.Object action)

Can the current user access this object to perform the named action?

java.lang.Object withUser(java.lang.Object identity, groovy.lang.Closure code)

Execute code masquerading as the specified user, for the duration of the Closure block

 

Method Detail

createLink

java.util.Map createLink(java.lang.String action)
Create a link to the specified security action
Parameters:
action - One of "login", "logout", "signup"
Returns:
Must return a Map of arguments to pass to g:link to create the link


getProviderName

java.lang.String getProviderName()
Implementations must return the name of their security provider
Returns:
A name such as "Spring Security"


getUserIdentity

java.lang.String getUserIdentity()
Get user id string i.e. "marcpalmer" of the currently logged in user, from whatever underlying security API is in force
Returns:
the user name / identity String or null if nobody is logged in


getUserInfo

java.lang.Object getUserInfo()
Get user info object containing i.e. email address, other stuff defined by the security implementation
Returns:
the implementation's user object or null if nobody is logged in


userExists

boolean userExists(java.lang.Object identity)
Determine whether a user with the given id already exists or not


userHasRole

boolean userHasRole(java.lang.Object role)
Return true if the current logged in user has the specified role


userIsAllowed

boolean userIsAllowed(java.lang.Object object, java.lang.Object action)
Can the current user access this object to perform the named action?
Parameters:
object - The object, typically domain but we don't care what
action - Some application-defined action string i.e. "view" or "edit"


withUser

java.lang.Object withUser(java.lang.Object identity, groovy.lang.Closure code)
Execute code masquerading as the specified user, for the duration of the Closure block
Returns:
Whatever the closure returns


 

Groovy Documentation