Blogs / Business Intelligence / Dashboards / Restricting a Tab to Specific Users in SAP Lumira Designer

Restricting a Tab to Specific Users in SAP Lumira Designer

Jan 18, 2018

SHARE

Challenge

 
Restricting a tab in an SAP Lumira Designer dashboard for a specific set of users, so not every user can view all the data that is provided in the dashboard. Here, we are going to explore the below actions-

  • Implementing user-based security on a dashboard using BEx queries
  • Hiding UI elements based on the BW user

Wondering if it’s possible? Yes, it is!!!

What we’re looking at achieving

 
Consider a dashboard where the Retail Sales Details are presented. It has two tabs, one is ‘Sales’ and the other is ‘Customer’. The UI elements such as the Customer tab inside this application needs to be hidden or displayed depending on the user accessing the application. In the example below, BW is used as the back-end source and TEXT components are used for building tabs, not tab-strips

Restricting a Tab to Specific Users in SAP Lumira Designer

Achieving it with a BEx query

 
All that is needed is a Query which contains the User list and their access flag value. I’m using BW as my backend, so I’ve created a separate BEx Query that contains only User names and access values.

Restricting a Tab to Specific Users in SAP Lumira Designer
Query Output

In HANA, the same functionality can be achieved by creating a table.

Note : The flag value can be defined as either a Key Figure or a Characteristic. We can handle it in SAP Lumira Designer using scripting. If it is a KF, declare it as 1 or 0 (Of course, 1 is for Users who have access and 0 for No Access)

Please refer the below image which represents the outline view of our application. Consume this query in SAP Lumira Designer as a Data Source. Here, it was named as DS_USERS. Make sure that Member for Filtering in the Edit Initial View of the Data Source is Only Values with Posted Data.

Restricting a Tab to Specific Users in SAP Lumira Designer
Edit Initial View

TEXT component is used for creating tab. Another TEXT needs to be inserted on the top of Customer tab TEXT Component.

Restricting a Tab to Specific Users in SAP Lumira Designer
Outline View of the Application

It is named as TEXT_TAB_CUST_MOCK. Given Below is the BIAL script that must be executed when the application opens (it can be directly written in APPLICATION properties->onStartup() event).
 
1. Get the Username that is currently logged in and save it in a variable

Restricting a Tab to Specific Users in SAP Lumira Designer

2. Declare a Boolean variable that’s initial value is false. This can be used for flagging (mark an item’s property/value for attention).

Restricting a Tab to Specific Users in SAP Lumira Designer

3. If the Access Value is created as a Characteristic, then follow this step or go to step 4.
 
(1) Apply filter on DS_USERS with the “Y” value. “Y” is the value given for the users who can see the tab.

Restricting a Tab to Specific Users in SAP Lumira Designer

(2) Now get members of the dimension USER in an array variable. (We need only the filtered values, i.e, the list of users who can access the tab. It’s better if you can filter them in the BEx query itself. But in this case, that option can’t be availed).

The code is as follow

Restricting a Tab to Specific Users in SAP Lumira Designer

(3) Check whether the logged in User name is in the filtered list or not. If it is there, set the flag value as true, else the flag value will remain as false.

Restricting a Tab to Specific Users in SAP Lumira Designer

 
Now you can directly go to Step 5
 
4. If the Access value is defined as Key Figure, then get the data for the particular user who is logged in currently. If the data value is 1, then set the flag value as true else the flag value will remain as false.

Restricting a Tab to Specific Users in SAP Lumira Designer

 
5. Set visibility to TEXT_TAB_CUST_MOCK based on the flag value.

  • If flag is true, then the user should access the customer tab, so this mock screen needs to be hidden. That is, set visibility – false.
  • If the flag value is false then the user should not access the tab, the mock screen need to be shown. That is set visibility – true.

So I’m writing the code as below,

Restricting a Tab to Specific Users in SAP Lumira Designer

6. If the tab is not going to be shown, the user need not know that such a tab exists. For UI / aesthetics, the first-tab’s layout properties are changed; so it fits the entire page width. The same CSS class that is applied on the selected tab (Sales Tab) needs to be applied on TEXT_TAB_CUST_MOCK and its text-align should be left.

Restricting a Tab to Specific Users in SAP Lumira Designer

Consolidated scripts are given below –

(i) If Access Value was defined as a characteristic please use below code.

Restricting a Tab to Specific Users in SAP Lumira Designer

(ii) If Access Value was defined as a Key Figure please use this code.

Restricting a Tab to Specific Users in SAP Lumira Designer

What the implemented solution looks like

Result of the application looks like below for the user who has access to the Customer Tab.

Restricting a Tab to Specific Users in SAP Lumira Designer

Result of the user who doesn’t have access to the customer tab looks like below,

Restricting a Tab to Specific Users in SAP Lumira Designer

Both outputs are from the same Dashboard!!!

Got questions? Click here to get in touch.


Corporate HQ:
5920 Windhaven Pkwy, Plano, TX 75093

+1 888-227-2794

+1 972-232-2233

+1 888-227-7192

solutions@visualbi.com


Copyright © Visual BI Solutions Inc.

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

Share This!

Share this with your friends and colleagues!