Jump to content

Setting application context


yodahart

Recommended Posts

I am writing a report that connects to an oracle database using table policies for security.  In these policies it expects there to already be some session context variables set before a query is run.  Is there a way to call a procedure before the sql is run for a report to set these variables?  I am planning on passing the user id to the report and calling a procedure/function with the id to set the context.

 

Thanks!

Link to comment
Share on other sites

  • 3 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

FYI...I've found a solution to this problem.  Here are my results:

 

It will require 2 parameters to be added to each report.  We will also have to pass 1 extra parameter to the report.

 

The 2 parameters that need to be added to each report are : CURRENT_USER_ID and SET_SECURITY.  They must be added in this order since they are dependent on each other!

 

CURRENT_USER_ID:

  This will be passed as a parameter through the url.  It will be the current user that is logged into you application.  You shouldn’t prompt for the value if none is passed.

 

SET_SECURITY:

  This will call a function in the database to set the session based on the first parameter before the actual SQL query is run.  Do not prompt for this value.

  The default value expression should be:

   $P{REPORT_CONNECTION}.prepareStatement(

"BEGIN SECURITY_PACK.SET_APP_CONTEXT('" + $P{CURRENT_USER_ID} + "'); END;" ).execute()

 

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