Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restricting input control values based on logged in user

I want to restrict the values in multi-select input control in my report based on the logged in user. For example, If manager logs in, he can see the list of all employees in the multi-select list. If an employee logs in, he will see only his name on the list. What is the best way to do that?

like image 492
saurabh730 Avatar asked Jan 21 '26 01:01

saurabh730


1 Answers

Try to add a new parameter "LoggedInUser" which will give you the LoggedIn User ID and then you can pass this parameter in where clause of the query

<parameter name="LoggedInUser" class="com.jaspersoft.jasperserver.api.metadata.user.domain.User"/>
<parameter name="FullUserName" class="java.lang.String">
    <defaultValueExpression><![CDATA[$P{LoggedInUser}.getFullName()]]></defaultValueExpression>
</parameter>
like image 60
Sharad Avatar answered Jan 23 '26 05:01

Sharad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!