Built-in Parameters for Logged In User

Overview

The following was extracted from Cascading Input Controls . As of version 3.7, the following parameters are available for query input controls. "Standard" controls will always be provided to reports (for example, for use in expressions), even if an input control is not defined for them.

 

Parameter Name Type Notes Standard?
LoggedInUser User Not usable in query input control, but is used as parameter to report Yes
LoggedInUsername String Of logged in user Yes
LoggedInUserFullName String Of logged in user No
LoggedInUserEmailAddress String Of logged in user No
LoggedInUserEnabled Boolean Is logged in user enabled? No
LoggedInUserExternallyDefined Boolean Is logged in user externally defined? ie. authenticated externally No
LoggedInUserTenantId String Of logged in user. Only relevant in Pro/Enterprise. No
LoggedInUserRoles Collection<string> Current set of roles of logged in user. Useful for $X parameter No
LoggedInUserAttributes Map<string, string> Not usable in query input control, but is used as parameter to report. Empty map if no attributes No
LoggedInUserAttributeNames Collection<string> User profile attribute names. Useful for $X parameters. Empty collection if no attributes No
LoggedInUserAttributeValues Collection - No
LoggedInUserAttribute_<attribute name> String Attribute value for matched attribute name (like "att1") on the user. Empty string if no match. Only provided if defined in a query or as a report parameter. No


Changes to parameters for reports in JasperReports Server

The above built-in parameters are also provided for reports if they are defined as parameters in the JRXML. This adds to the LoggedInUser and LoggedInUsername parameters that are available in earlier versions.

Examples

Print When Expression example:

($P{LoggedInUserRoles}.toString().contains("ROLE_ADMINISTRATOR")) ? new Boolean(true) : new Boolean(false)

Page footer example:

"Last printed by " + $P{LoggedInUserFullName} + " on "  + new java.util.Date()     + "\n LoggedInUserRoles include: " + $P{LoggedInUserRoles}.toString()

This is an example of Logged In User Attributes in an iReport, domain-based report:

  • JasperReports Server Ultimate Guide - Security definition
  • JasperReports Server Ultimate Guide - JRXML

 

See Also

Feedback
randomness