Jump to content
Changes to the Jaspersoft community edition download ×
  • Built-in Parameters for Logged In User


    eongaro
    • Features: Input Controls, Parameters Product: JasperReports® Server

    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.

    [toc]

     

    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

    For the logged-in user, the value of the attribute matching the name passed as <attribute-name> (such as att1). If there's no attribute with this name for this user, the parameter is empty.

    This parameter is available only if it's defined in a query or as a report parameter.

    No

    LoggedInTenantAttribute_
    <attribute-name>

    String

    Same as above, but only checks for Organization-level attributes.

     

    ServerAttribute_<attribute-name>

    String

    Same as above, but only checks for Server-level attributes.

    No

    Attribute_<attribute-name>

    String

    Recommended.

    Same as above, however this will check each level of attributes, in order, until one is matched:

    • On the logged-in user

    • On the Organization of the logged-in user, then in any parent organizations

    • At the server level

    No

    For a full list, refer to: https://community.jaspersoft.com/documentation/tibco-jasperreports-server-administrator-guide/v790/query-based-input-controls#Built-in_Parameters

    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.

    When you create a parameter in the Report, its Type must match the Type from the above list.

    Examples

    Print When Expression example (also attached to this article as LoggedInUserRoles.jrxml):

    ($P{LoggedInUserRoles}.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

    KK edited 2022-05-23

    loggedinuserroles.jrxml


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...