Hitachi Vantara Pentaho Community Forums
Results 1 to 31 of 31

Thread: Session variable of user name?

  1. #1

    Default Session variable of user name?

    Hi everyone

    Is there a variable I can use it in SQL 'where' clause in a XACTION file? I mean that the variable will be initiated by Pentaho when the user login portal, and I can use the variable directly in XACTION where clause looks like '{name}'?

    Thanks a lot, any reply will be appretiated!

    David

  2. #2
    Join Date
    Nov 1999
    Posts
    579

    Default Re:Session variable of user name?

    Have you looked at the sample solution action sequences?

    I suggest using grep (or another like tool) for <user

  3. #3

    Default Re:Session variable of user name?

    Hi Marc

    Thanks for your suggestion, but unforturnately, i can not find from xaction files from below:

    headcount_actual_by_region.xaction. headcount_variance_by_region.xaction etc.

    Am I on a wrong way of understanding? Where I can get the user name who have logged in and use it in the SQL sections of these xaction files?

    Please help me more, I have been held for several days!

    David

  4. #4
    Join Date
    Nov 1999
    Posts
    579

    Default Re:Session variable of user name?

    Please see:

    samples/rules/session-region-list.xaction
    test/rules/script_rule2.xaction

  5. #5

    Default Re:Session variable of user name?

    Hi Marc

    I appreticated your prompt reply and followed the direction you flaged. I did

    1. Open headcount_variance_by_region.xaction, and add a INPUT item name is user as below


    name



    2. Edited the SQL statement in ![CDATA[ section as below
    where user_name='{user}'

    3. Login portal server as admin and refresh the portlet, but

    Nothing happen?!

    Well, I do know why it did not work when I used same path from your sample?

    Sounds like I need further help from you!

    David

  6. #6
    Join Date
    Feb 2006
    Posts
    27

    Default Re:Session variable of user name?

    Ok, if I understand this the following code...
    Code:
    <inputs>
    	<user type="string">
    		<sources>
    			<session>name</session> 
    		</sources>
    	</user>
    </inputs>
    will grab the user name from the session information. Cna you do the same for hte password as a means of a single sign on solution?

    Post edited by: jfizer, at: 05/04/2006 18:10

    Post edited by: jfizer, at: 05/04/2006 18:12

  7. #7
    Join Date
    Nov 1999
    Posts
    579

    Default Re:Session variable of user name?

    Please zip up your action sequence and attach it for us to review when we get a chance.

  8. #8

    Default Re:Session variable of user name?

    Thanks Marc

    Please review the attachment. Thanks for your help!

    David http://forums.pentaho.org/archived_a..._by_region.zip

  9. #9

    Default Re:Session variable of user name?

    Hi Marc

    I guess I ingored a important section in my zip file. I should add not only in

  10. #10

    Default Re:Session variable of user name?

    Hi Marc, here is the new zip file. Thanks!

    David

  11. #11

    Default Re:Session variable of user name?

    Hi Marc

    One more time uploading, cause the files name can not be same, and rejected my file but accepted my topic. Hopefully no bothering.

    David http://forums.pentaho.org/archived_a...region_new.zip

  12. #12
    Join Date
    Nov 1999
    Posts
    579

    Default Re:Session variable of user name?

    Your problem is that you're using the user input, but haven't defined it as a valid input to your action (in the action-inputs)

    You should try using the Design Studio for editing your action sequence. I believe it would have made this part more clear, and would have made sure that the inputs were correct.

    Take care,

    Marc

  13. #13

    Default Re:Session variable of user name?

    Hi Marc

    Thanks for your reply. Hopefully I could find where I can download the design tools.

    As to the Sequence file, actually I have redefined it and uploaded it last week, in the file, I have added the user parameters into action input section. However, I got a error message claimed that the user parameters can not be performed?

    Would you please roll back to my old reply last week? I appreciate you very much.

    Further question, where I can get more detail debug information despiting /deploy/log/server.log?

    Thanks your help again!

    David

  14. #14

    Default Re:Session variable of user name?

    Hi Marc,

    would you please review my new version of Sequence file uploaded? I do not know why it does work. The error message is

    2006-05-08 12:42:59,388 ERROR [org.pentaho.runtime.RuntimeContext] b555d658-deb1-11da-b059-b5c023254982:RUNTIME:context-5636329-1147106579373:headcount_variance_by_region.xaction RuntimeContext.ERROR_0018 - The requested parameter user could not be fulfilled
    2006-05-08 12:42:59,388 ERROR [org.pentaho.runtime.RuntimeContext] b555d658-deb1-11da-b059-b5c023254982:RUNTIME:context-5636329-1147106579373:headcount_variance_by_region.xaction RuntimeContext.ERROR_0013 - Parameters could not be resolved


    Thanks a lot

    David

  15. #15
    Join Date
    Nov 1999
    Posts
    579

    Default Re:Session variable of user name?

    I would have loved to. Except it wasn't attached!

    Take care,

    Marc

  16. #16

    Default Re:Session variable of user name?

    Hi Marc

    I am sorry and it looks stupid as well. . Now it should be on its up.

    David http://forums.pentaho.org/archived_a...region.xaction

  17. #17

    Default Re:Session variable of user name?

    Hi jfizer

    Thanks for your kind suggestion, yes, it should be a correct way, but my problem is how to make it work. I add the section in

  18. #18

    Default Re:Session variable of user name?

    Hi Marc

    Have you received my uploaded xaction file? Please kindly check it for me, I am not able to find any bug in it. But it just refuses to work.

    Thanks for your help!

    David

  19. #19
    Join Date
    Nov 1999
    Posts
    579

    Default Re:Session variable of user name?

    Ok,

    Here is what I did to attempt to duplicate any issues your having:

    a- Downloaded the latest PCI from sourceforge and unzipped it

    b- Modified the sampledata table (sampledata.script) and added a new column (user_name) to the actuals table. I also modified all the inserts into that table to include either the user 'joe' or the user 'suzy' into the new column.

    c- Changed your action sequence as attached changing the JNDI name to SampleData, and simplifying the query to select based on the user.

    d- Started the PCI from the command line.

    e- Logged into the portal as joe

    f- Set the portal style to the pentaho style (because of overlapping portlets over the tabs).

    g- Switched to the Pentaho portal.

    h- Chose the reporting tab at the top of the portal

    i- Ran the attached action sequence.

    My results showed that everything is working just fine. The query executed, and only returned rows belonging to joe.

    Bottom line - I cannot duplicate your problem - the platform is performing as designed.

    I hope this helps,

    Marc http://forums.pentaho.org/archived_a.../headcount.zip

  20. #20

    Default Re:Session variable of user name?

    Hi Marc

    I know I confused you using a unproper expression. Sorry for that! Does the grabing of user in session only works in PCI mode? Actually, I just modified the demo 1.1.1.0 for presentation.

    After I defined the

  21. #21
    Join Date
    Nov 1999
    Posts
    579

    Default Re:Session variable of user name?

    Your post managed to get truncated for some reason. From the little bit of the post that remains, your question was whether it only works in PCI mode.

    There really isn't a PCI "mode" - basically, the PCI just stands for pre-configured installation. That means that we've done the following:

    a- Started with the latest JBoss Portal drop (includes the JBoss server with the JBoss Portal integrated).

    b- Updated some .jar files as required

    c- Updated the portal users by modifying the file server/default/data/portal/hypersonic/database.script

    d- Deployed the Pentaho web-application (pentaho.war), the styles (pentaho-styles), portlet deployment, and various other changes.

    e- For portal authentication, we just slightly modified the login.jsp in the jboss-portal.sar/portal-server.war directory and added speed-accessors for logging in as suzy or joe.

    That's about it.

    If the user is coming out as null in the session, it seems that the following has happened:

    You've (or someone has) somehow fundamentally altered how the portal authentication works such that the javax.portlet.ActionRequest.getRemoteUser() call is returning null. This could be because you've somehow changed the post action in the login.jsp to no longer be posting to j_security_check, or perhaps you're not even authenticating through the portal security layer.

    To debug this, you may need to debug the platform within Eclipse. If you're technically savy, setting it up shouldn't be too much trouble. You'll need the following:

    1- The full Eclipse Platform
    2- JBoss IDE (available as a plugin from JBoss)
    3- The Pentaho source code (available from sourceforge.net)

    I suggest you stick a breakpoint in BasePortlet at or around line 116 which looks like this:

    Code:
      String user = request.getRemoteUser();
    I hope this helps,

    Marc

  22. #22
    dmoran Guest

    Default Re:Session variable of user name?

    No,

    We don't actually get the password from the authentication mechanism and it would probably be a security hole if we did. If you really needed this and thought it was a good idea, you could probably provide your own login page and pass the login info to the portal and save the UserId and password within the pentaho session. I don't recommend this however.

    Doug

  23. #23

    Default Re:Session variable of user name?

    Hi Marc

    Thanks for your thorough explain, so considerated, I am really appreciated it! What's driving me crazy is that:

    Same thing is perfect in your environment, but it refuses working in my environment. ( nobody has the right of touching my environment), user authorization process is the last thing left of my DEMO for my presentation to my BOSSes! Below is my latest effort to grab user from session:

    1. Downloaded Demo file, version 1.1.1.5 : pentaho_demo-1.1.5.262.zip
    2. Unzipped it
    3. Double clicked start-pentaho.bat, and waited for starting process end
    4. Transferred to Direction C:\\pentaho\\pentaho-demo\\pentaho-solutions\\samples\\portal
    5. Edit headcount_variance_by_region.xaction
    ---Added code in

  24. #24

    Default Re:Session variable of user name?

    Hi Marc

    Thanks for your thorough explain, so considerated, I am really appreciated it! What's driving me crazy is that:

    Same thing is perfect in your environment, but it refuses working in my environment. ( nobody has the right of touching my environment), user authorization process is the last thing left of my DEMO for my presentation to my BOSSes! Below is my latest effort to grab user from session:

    1. Downloaded Demo file, version 1.1.1.5 : pentaho_demo-1.1.5.262.zip
    2. Unzipped it
    3. Double clicked start-pentaho.bat, and waited for starting process end
    4. Transferred to Direction C:\\pentaho\\pentaho-demo\\pentaho-solutions\\samples\\portal
    5. Edit headcount_variance_by_region.xaction
    Added code like below
    Code:
    		 
    		 
    	             
    	              name
    replease the SQL statement in the sequence file as below

    select POSITIONTITLE, (CAST(ACTUAL AS FLOAT)*100/CAST(BUDGET AS FLOAT))-100 as VARIANCE from quadrant_actuals where (REGION='{REGION}' or REGION='{user}') and DEPARTMENT='{DEPARTMENT}' order by POSITIONTITLE

    Boled words is what I added in the sql to track the variable 'user'

    6. Loggin into portal server as Joe
    7. Navigated to Portal, then refresh the portal page, anything is fine
    8. Open the server.log (/Server/default/log/server.log)
    9. Addressed the SQL as below

    select POSITIONTITLE, (CAST(ACTUAL AS FLOAT)*100/CAST(BUDGET AS FLOAT))-100 as VARIANCE from quadrant_actuals where (REGION='Southern' or REGION='') and DEPARTMENT='Human Resource' order by POSITIONTITLE

    please pay attention to the bolder block, user variable value appears null, right?

    So, I am confusing why i can not grab the value like your sample? What is the wrong i did? I do not think I altered the fundermental stuff, right?

    Hopefully, you could help me out of the mirage? thanks!

    david

  25. #25
    Join Date
    Nov 1999
    Posts
    579

    Default Re:Session variable of user name?

    David,

    There was one other possiblity I didn't consider - that's a bug of some sort.

    Well, you have revealed a bug (I'm creating a JIRA case on it so we can track it down).

    Anyway, no worries --- I have a work-around for you.

    Here's the deal of why it worked for me, but not for you. When I was running my action sequence, I wasn't using it from the Portlet perspective. That is, I definitely authenticated with the portal, then ran the action sequence. Everything ran perfectly. However, in the dashboard samples, those are executing as portlet widgets. Why the user isn't in the session for them? I don't know - that's the bug that has to be worked out.

    Anyway - on to the work-around. We handle getting the user name into stuff two different ways. One is with a bona fide input (as I've communicated to you before and which is broken under this particular circumstance), and the other is with a special use of the template component.

    Here is what you can do to get around this problem until we fix it properly:

    a- Remove the <user> stuff you put in the action sequence - both the input variable in the inputs at the top, and in the action-inputs.

    b- Replace the '{user}' with '{$user}' in the SQL statement.

    This is a special variable that the template component looks for, and does a replacement.

    I'm sorry this one has been making you scratch your head for so long. I'll work on a fix ASAP.

    Thanks for your patience,

    Marc

  26. #26

    Default Re:Session variable of user name?

    Hi Marc

    I appreciate you posting so many reply for my simple question, but meanwhile I have to admit that this problem is drive me and my supervisor crazy, because customers is waiting for trying it for two weeks.

    Yeah, I should use Design studio to do that, I prefer that, but I have not installed it on my computer. So I am expecting a shortest way to solve this problem. (I have add the user in action-input section, but still did not work, evenmore, when I setup the default value in INPUTS section, no matter how to grab variable from session, the value of user always is default value! please check the latest sequence file I uploaded).

    I compared my sequence file with your zip file which worked fine in your environment, I could not find any difference between mine, that is why I consider it is not the designe studio issue.

    Anyway, I will try the single step debug, it costs more time, and I don't know what's my supervisor opinion about that. So hopefully, I could get a rapider reply from you via

    1. Telephone, you can charge me by hours, my telephone
    Cell Phone: (416)400 0988
    Office Phone: (416)586 4800 ext. 2221

    2. Instance massager online:
    MSN: hu.xie@hotmail.com (Available in off-working time, even Sat. and Sun.)
    Google talk: dave.xiehu@gmail.com (Working time, include today off-working time, cause I am going to overtime, I am online right now)

    3. Please leave your telephone number or Email, I can contact you positively.

    I understand your guys are so busy, and we haven't pay anything to you, and today is Friday. But for the future of pentaho in my organization, please kindly contact me ASAP!

    Thanks so much over these words!

    David Xie

    Data Warehouse Developer

    Informatics Division, Mount Sinai Hospital
    201-600 University Ave.
    Toronto, CA M5G 1X5
    Phone (416) 586-4800 ext. 2221
    Cell (416) 400-0988
    Dave.xiehu@gmail.com

  27. #27
    Join Date
    Nov 1999
    Posts
    579

    Default Re:Session variable of user name?


  28. #28

    Default Re:Session variable of user name?

    Hi Marc

    Thank your so much for your calling betimes, I really appreciate that. As developers we both are, you concerned my situation as you were in, and help me no charge on Friday night. And I tried your work-around solution, got successful result on my laptop at home. So it encouraged me go further on Pentaho.

    My schedule is that we will open my trial website of Pentaho to our financial dept., let these financial analyst try it first. After that, the case cost performance dept. will be on the line, so next month there maybe are two dept. BI application running on Pentaho. After the two step, I am sure our hospital would buy a one period technical support. I know you will keep away these stuff of money as me, so we could communicate more on technique, leave money affair to James and my supervisor. :-)

    Anyway, thanks so much help us out of the problem. have a nice weekend!

    David

  29. #29
    Join Date
    Feb 2007
    Posts
    1

    Default

    Quote Originally Posted by jfizer View Post
    Ok, if I understand this the following code...
    Code:
    <inputs>
        <user type="string">
            <sources>
                <session>name</session> 
            </sources>
        </user>
    </inputs>
    will grab the user name from the session information. Can you do the same for the password as a means of a single sign on solution?
    I also encountered this question.
    Did anyone know?

  30. #30

    Default

    Hi,
    Have you find the list of environment variables that I can use in a designe studio ?
    I'm tring to pass the username to the sql (where condition) in a xaction (design studio), ad-hoc report and in report studio, but I don't find documentation. I have Pentaho 3.5.2.
    Have you find any documentation ?

    Giovanni

  31. #31
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    XAction related questions should be asked in the biserver forum.

    Also: Pulling a ancient thread from its grave is not going to help, three to four years of development change things a bit (at least in the open-source world, where people are more agile than in the closed source environments)
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.