September 22, 2011

Security on Components in Xcelsius

When you have a dashboard, usually any user that views the dashboard will see the same as any other user. You may be filtering your data based on row-level security in your data source, but what if you want some components to only be visible to some users?

In this post, I’ll explain how you can set up a dashboard that will allow certain users to adjust a target value used in a chart.

I’m Using

  • BOBJ XI3.1 SP3
  • Xcelsius 2008 SP4
  • InfoView/Webi

I’m Assuming

  • You know your way around Webi
  • You know your way around Xcelsius

 

The Dashboard

Firstly, the result. Below is the marvellous System Monitoring Dashboard by Avantis. It allows users to see statistics from the Business Objects audit database. One of the charts relates to the number of users accessing the system.

image

In the below example, I will set up the dashboard to allow administrators to adjust the concurrent user target (based on the number of licences available) without having to edit the dashboard model in Xcelsius.

Of course you can use this logic for other purposes, for example adjusting KPI targets or adding persistent comments to a dashboard.

 

Knock knock

First we need to establish which user is running the report. For this to work, you don’t need any particular type of security, but you do need to be delivering the dashboard through InfoView because we will use a Webi report to fetch the name of the logged in user.

  1. Create a new Webi report, I’m using my Audit universe for simplicity, but the universe you use is not important. Just make the query a fast one.
  2. Add a variable to your report and configure it like so:
    image
  3. Arrange it in a block like so:
    image
    I’m adding some extra text in here, which I’ll use in my dashboard. I’ve done this so that wording in the dashboard can essentially be edited in Webi.
  4. Now create a BI Service so that we can get this data into Xcelsius. If you’re not familiar with BI Services, check this out. If you like, you could also use LiveOffice.
  5. Open up Xcelsius and your dashboard model.
  6. Create a new connection to the BI Service you just created. (Remember that the connection type must be Query as a Web Service, not Web Service Connection. QaaWS does all the nice authentication stuff.)
  7. Make sure that you set the connection to refresh the source document. Otherwise, you will just see the name of the user that scheduled the Webi report. To do this, select the refresh option in the Input Values section, then in the Read From box, type in TRUE. I’ve heard of some people having trouble with this. If you do, try using 1, and/or setting getFromLatestDocumentInstance to FALSE or 0.
    image
  8. Bind the connection to your spreadsheet and set it to refresh before components are loaded on the Usage tab.
  9. I’ve added a label to the report so that I can check that the report is being refreshed successfully:
    image
    When testing a dashboard that involves authentication, I suggest publishing the dashboard to the repository, rather than clicking Preview.
  10. Log into InfoView as different users, open the dashboard, and ensure that the correct user name shows.

 

Conditional Visibility

The following steps are fairly basic Xcelsius, so I’ll skip some of the detail.

  1. Add a series to the chart to show the target, in this case available licences.
    image
    I’ve used black and white to differentiate the target line from the other lines. If you really wanted, you could layer a second chart for individual control of the target line.
  2. Use a formula to copy the value from a single cell to all cells in the range you’re using for the chart. This single cell is what the user will change, which will affect the whole line in the chart.
  3. Now add the components you need to change that value. I’ve added a pop-up that will let the user change the number of available licences via a spinner component. I’ve also added a comments box to allow an administrator to show a message to other users.
    This setup is a combination of a push button that changes the value of a cell from “Hide” to “Show”. The spinner and other components are in a container with conditional visibility based on that cell containing “Show'”.
    image
  4. Next, all we need to do is show or hide that “Edit'” button to control who can change the value or available licences. This is, I’m sure you’ve guessed, pretty simple.
    image
    • The four grey cells are the data from my BI Service.
    • The orange (peach?) cell is a formula with the text for my label.
    • The lowest cells are a list of people for whom I want the “Edit” button to be visible.
    • The blue cell is a formula that says: If the user above is in the list below, show the button, otherwise hide it.
      =IF(COUNTIF(A9:A111,B3)>0,"Show","Hide")
    • Then I bind the dynamic visibility of the “Edit” button to that blue cell.
  5. When a non-administrator logs in, they will not see the “Edit” button, but will see the correct value for concurrent licences, as well as any comment added.
    image
  6. That’s it! (Almost.) Publish the dashboard and open it up in InfoView. If your user is in the list, you should see the edit button, otherwise it will be hidden.

 

Almost…

All this is works, but you’ll notice that any change that is made is not saved for the next time the dashboard is used. So the final trick here is that you can then use an XML Data connection to write that single cell back to an XML file on the server, and of course read the file when loading.

The technique for doing this is detailed in the post Saving Scenarios in Xcelsius. But the solution to save a single value (rather than a potentially endless collection of scenarios) is much simpler for this application.

OK, so there’s an easier way to achieve this. You can simply have a Webi block with all of the metrics that you want to be able to change (comments, KPIs, etc.) and import that block with BI Services or LiveOffice. This will give the same result, but it’s nowhere near as cool.

 

P.S.

If you’ve been dying to know what’s on the other two tabs of this dashboard, here they are:

image

image