Referencing Information About the Current User

The adf.context.getSecurityContext() expression provides access to the security context, from which you can access information about the current user like her user name or whether she belongs to a particular role.

The following code illustrates how to reference these two pieces of information:

// 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
}