Jump to content
Changes to the Jaspersoft community edition download ×

Go to solution Solved by elizam,

Recommended Posts


I am defining domain security using profile attribute, but i am not able to do it.

below is my security file. Can anyone tell me what is missing in this file?

            <resourceAccessGrant id="JoinTree_1__row_grant">
                      <![CDATA[authentication.getPrincipal().getAttributes().any{ it.getAttrName() in ['storecity'] }]]>
            <filterExpression>public_store.store_city in (groovy('authentication.getPrincipal().getAttributes().find{ it.attrName == "storecity" }.attrValue'))</filterExpression>


Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

  • Solution

You need stuff around this - the example in the Ultimate Guide has this much:

<securityDefinition xmlns="http://www.jaspersoft.com/2007/SL/XMLSchema" version="1.0" itemGroupDefaultAccess="granted">
<!-- Row level security -->
<!-- What access do roles/users have to the rows in the resource? -->
<resourceAccessGrantList id="JoinTree_1_List" label="ListLabel"
<!-- Row level for Cities -->
<resourceAccessGrant id="Jointree_1_row_access_grant_20">
{it.attrName in ['Cities'] }]]></principalExpression>
<!-- Row level for Product Dept -->
<resourceAccessGrant id="Jointree_1_row_access_grant_30">
{it.getAttrName() in ['ProductDepartment'] }]]></principalExpression>

Have you set up the profile attributes you want for your users?  I also normally use the testProfileAttribute function instead of the groovy - is there some reason you are doing it that way? What version of JRS are you using?

Link to comment
Share on other sites

Thanks Elizam !!!  This is working fine now. I was doing it from the JasperReport Server User Guide. In that, only Groovy example is given. I am using 5.0.1 version.

I tried with TestProfileAttribute earlier, but it was working. I dont know why?? 

Can you tell me what is the difference between this two - 

1) <![CDATA[authentication.principal.attributes.any{it.attrName in ['Cities'] }]]>

2) <![CDATA[authentication.getPrincipal().getAttributes().any{it.getAttrName() in ['ProductDepartment'] }]]>

There is no such reason for using Groovy, I wanted to apply security using Profile Attribute and I got example of groovy. 

Thanks once again !!



Link to comment
Share on other sites

  • 7 years later...

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...