Ive decided to create a new category called "Snippets" to capture small chunks of information which might be useful to other people
In Groovy
// Get the security context
def secCtx = adf.context.getSecurityContext()
// Check if user has a given role
if (secCtx.isUserInRole('MyAppRole')) {
// get the current user's name
def user = secCtx.getUserName()
// Do something if user belongs to MyAppRole
}
In a EL Expression
#{securityContext.userName}
No comments:
Post a comment