Jump to content
We've recently updated our Privacy Statement, available here ×

Page Level Security in Jasper report output


kakkar

Recommended Posts

Can someone please let me know if page level security feature is supported in Jasper Reports. By page level security, what I mean is that if a report is 1000 pages long (for an administrator or someone who has the overall access to the data) and if the User A should have access to only 501 to 505 pages of this report, then if User A logs in and generates this report, then he/she should see only a 5 page report with the contents of 501 to 505 pages of the actual report.

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

hello kakkar,

I don't know if there is a way to do it simply just by the iReport desgin, but you can do it in several other ways...You can add a "security_level" field in you BD tables where the content you want to access are, like "levels 0, 1, 2, 3, 4 ..." and when a user with level 1 tries to generate the report, in the query you use "where security_level <= $P{level}" or something like that....Do you get me?

 

for example:

TABLE CONTENT (content, security_level)

TABLE USER (user_name, user_level)

 

and you have the levels 1, 2 and 3 (3 is the adm who can see all levels, the level 2 can see 2 and 1, and level 1 can see only 1)

in the report query:

SELECT content from CONTENT where security_level <= user_level

 

 

I hope i helped.

Link to comment
Share on other sites

Thanks for your response.

Can this functioanlity be accomplished during report VIEW time. Actually we are using Actuate currently and are planning to migrate to Jasper. In Actuate, report generation happens(only once) for all the 1000 pages at one shot and the output will be placed in a location. Later while viewing the report, every user will access their respective privileged pages out of total 1000 pages as per their roles on the same report output.

Can this be accomplised in Jasper.

Link to comment
Share on other sites

Hi again,

 

So, if i understood it right, with this actuate you generate the report (only once) and keep it saved in a dir, then when the user wants to see the report your application will get it at this dir where it is kept??

 

In jasper you can generate the report in runtime, so you won't just generate a report only once, you will have a .jasper file in a dir inside your application's folders, then when the user wants to see it, you can use JRExporters (like RTF, PDF, ODT, ODS, etc. exporters) and it will generate in run time. So yes, you can use what I said before (or something like it) to do the security thing.

 

I hope i helped.

GAM

Link to comment
Share on other sites

Thanks a lot Gam. I appreciate your responses and it is really helping a lot.

The answer to your question about generating the report in Actuate is "Yes and it is just not getting the output of the report but also by applying security to the report output, as per the logged user role/privileges."

Just have a question on your response on Jasper:-

Whether the JRExporters will export the output by applying security on .jasper file, as per the logged user role/previlage?? Example: A report is generated with 1000 pages and the .jasper file is placed in a dir.  for user-1, the JRExporters should get all the 1000 pages from the .jasper file and for user-2, the JRExporters should get the subset of the output from the same .jasper file, as per the user-2 role/previlage and so on for all the users. Is this possible??

 

Thanks,
Ritesh Kakkar

 

Link to comment
Share on other sites

Hello again Kakkar, sorry for the delay on this response, I was traveling : )

 

Sorry i don't think i understood right what you are asking...

 

Your application, is local? you want the report to be like a ".doc" file or something like that? because with the jasper, you can use the JRExporter in your application, and within the jasper you will have a query to a database, in this query you will do something like what i said before, and then your report will only contain what that user can see. so it won't be just one document for all the users, instead, one document per user level, but using the same .jasper file.

Link to comment
Share on other sites

  • 2 weeks later...

Ritesh,

 

The jasper file does not hold data.. It just fetches the data during runtime...so, when the .jasper is called what happens is this:

  • The user information is passed to the .jasper
  • .jasper fetches data from db based on user information
  • This user specific data is alone displayed in PDF
  • Whn a different user runs the report, .jasper fetches rows from DB based on that user information and that data alone is displayed in output pDF or DOC

So, thinking that .jasper holds 1000 pages by default is absurd... it DOES NOT HOLD DATA.. IT POPULATES DATA only during runtime

 

 

 



Post Edited by madhukiran at 10/27/2010 09:53
Link to comment
Share on other sites

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