juser2013 Posted January 28, 2014 Share Posted January 28, 2014 Hi, 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"> <principalExpression> <![CDATA[authentication.getPrincipal().getAttributes().any{ it.getAttrName() in ['storecity'] }]]> </principalExpression> <filterExpression>public_store.store_city in (groovy('authentication.getPrincipal().getAttributes().find{ it.attrName == "storecity" }.attrValue'))</filterExpression> </resourceAccessGrant> Thanks, Link to comment Share on other sites More sharing options...
Solution elizam Posted January 29, 2014 Solution Share Posted January 29, 2014 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"><resourceAccessGrants><!-- Row level security --><!-- What access do roles/users have to the rows in the resource? --><resourceAccessGrantList id="JoinTree_1_List" label="ListLabel"resourceId="JoinTree_1"><resourceAccessGrants><!-- Row level for Cities --><resourceAccessGrant id="Jointree_1_row_access_grant_20"><principalExpression><![CDATA[authentication.principal.attributes.any{it.attrName in ['Cities'] }]]></principalExpression><filterExpression>testProfileAttribute(store.store_city,'Cities')</filterExpression></resourceAccessGrant><!-- Row level for Product Dept --><resourceAccessGrant id="Jointree_1_row_access_grant_30"><principalExpression><![CDATA[authentication.getPrincipal().getAttributes().any{it.getAttrName() in ['ProductDepartment'] }]]></principalExpression><filterExpression>testProfileAttribute(product_class.product_department,'ProductDepartment')</filterExpression></resourceAccessGrant></resourceAccessGrants></resourceAccessGrantList></resourceAccessGrants></securityDefinition>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 More sharing options...
elizam Posted January 29, 2014 Share Posted January 29, 2014 In case you haven't already, you should look at the Ultimate Guide, which goes into row security in detail. The link to an earlier PDF of the Ultimate Guide is here: http://community.jaspersoft.com/documentation/jasperreports-server-ultimate-guide The HTML version should be up soon. Link to comment Share on other sites More sharing options...
juser2013 Posted January 30, 2014 Author Share Posted January 30, 2014 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 More sharing options...
Mehul Bamania Posted March 2, 2021 Share Posted March 2, 2021 Here its a video of Domain Security from the Dr Jaspersoft: More Videos:https://community.jaspersoft.com/wiki/dr-jaspersoft Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now