JASPER SERVER登录用户相关的内置参数

与登录用户相关的内置参数列表:

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

 

 

创建参数LoggedInUser,引用类:com.jaspersoft.jasperserver.api.metadata.user.domain.User

 


其他登录用户相关内置变量设置成相应的STRING、MAP、COLLECTION等即可。

 





设计报表:

 

 只能在服务器上查看效果:

 

 


 

代码段:

         <parametername="LoggedInUser"class="com.jaspersoft.jasperserver.api.metadata.user.domain.User" isForPrompting="false"/>

         <parametername="LoggedInUsername" class="java.lang.String"isForPrompting="false"/>

         <parametername="LoggedInUserFullName" class="java.lang.String"isForPrompting="false"/>

         <parametername="LoggedInUserEmailAddress" class="java.lang.String"isForPrompting="false"/>

         <parametername="LoggedInUserEnabled" class="java.lang.Boolean"isForPrompting="false"/>

         <parametername="LoggedInUserExternallyDefined"class="java.lang.Boolean" isForPrompting="false"/>

         <parametername="LoggedInUserTenantId" class="java.lang.String"isForPrompting="false"/>

         <parametername="LoggedInUserRoles" class="java.util.Collection"isForPrompting="false"/>

         <parametername="LoggedInUserAttributes" class="java.util.Map"isForPrompting="false"/>

         <parametername="LoggedInUserAttributeNames"class="java.util.Collection" isForPrompting="false"/>

         <parametername="LoggedInUserAttributeValues"class="java.util.Collection" isForPrompting="false"/>

 

 

 

 

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()

 

 

 

使用URL传递用户名和密码

http://104.197.68.11/jasperserver/flow.html?_flowId=viewReportFlow&_flowId=viewReportFlow&ParentFolderUri=%2Freports&reportUnit=%2Freports%2FAPAuditWithLicense&standAlone=true&j_acegi_security_check&j_username=jasperadmin&j_password=.......&decorate=no&output=pdf?LicenseId=1

 

 PDF下载:http://download.csdn.net/download/qq_16215957/10010562

 

作者:狮子王

经历:从事大型企业信息化工作22年,擅长IT战略管理,覆盖运维、开发、大数据等领域。

QQ:179170396

 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

qq_16215957

如果有帮助一杯咖啡奶茶均可

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值