Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Determine Currently Logged in Pentaho User from BIRT Report

  1. #1

    Default Determine Currently Logged in Pentaho User from BIRT Report

    I have a BIRT report that I'm planning to run from inside the Pentaho bi-server. I currently have BIRT prompt for the user's username and password as a BIRT parameter. BIRT then uses those credentials to run the report.

    Is it possible for the BIRT report to detect the currently logged in pentaho user to run the report based on their credentials? This would save reporting users from having to enter their credentials before running each individual report.

    Thanks.

  2. #2

    Default

    If you are using the BIRT viewer from within the user console (if not, see tutorial), then you could use an action sequence that fetches the username and passes that on to the BIRT report.
    You will have to implement some sort of obfuscation to prevent people from just passing a different username on the url though...

    Regards,
    Bart

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

    Default

    Or, if Birt supports scripting to get values, you can use that to query the platform for the user.

    The Java/BeanShell-Code is

    Code:
            final Authentication authentication = SecurityHelper.getInstance().getAuthentication();
            if (authentication == null) {
              return null;
            }
            ITenantedPrincipleNameResolver tenantedUserNameUtils = PentahoSystem.get(ITenantedPrincipleNameResolver.class, "tenantedUserNameUtils", session);
            String userName = null;
            if(tenantedUserNameUtils != null) {
              userName = tenantedUserNameUtils.getPrincipleName(authentication.getName());
            } else {
              userName = authentication.getName();
            }
    
            return userName;
    It should be relatively easy to translate that into either Groovy or JavaScript if needed.
    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 - 2017 Pentaho Corporation. All Rights Reserved.