Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Using a parameter to authenticate against a database
kbog
Hi,
I'm new to Birt and I'm looking for general advice on how to take a url parameter and use it to authenticate access to a report and then possibly send an HttpRedirect upon failure.
I found an example of accessing the parameter in the beforeFactory event. I think I'm good with getting the parameter. But my question is from where (which event) do I access the database and then send a redirect.
My other option if I can not send a redirect is to print on the report the url with a message to go and login first before accessing this report. But I'd prefer to do the redirect.
Do I create a data Source/Data Set and then redirect from there off the return value from the database in a fetch?
Sorry if this is covered somewhere already and I missed it. Thanks in advance
Find more posts tagged with
Comments
kclark
Is there a reason you need to redirect over other methods? You should be able to use a redirect script to move away from the page. Another way to keep the user from viewing the report is put the entire report in a grid named mygrid and you could do something like this.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if(params["username"].value != "kclark") {
reportContext.getDesignHandle().findElement("mygrid").drop();
</pre>
kbog
Thank you very much for the reply and the code snippet. Any chance of an example of what a redirect script might look like? And under which event to activate it. Regarding the example you provided--First once again thank you for the help--<br />
Under the model I think that you are recommending, would I have two datasets?<br />
<ul class='bbcol decimal'><li>The first dataset would fire the fetch and authenticate that you are logged in and drop the grid if not logged in. </li><li>The second data set would only run if the grid was not dropped --and actually fetch the data for the report</li></ul>
<br />
Does this match what you are proposing?