Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey guys, it's been awhile since we had a guest blogger on, so today I am pleased to introduce you to Daniel Pilla. Daniel is a Master Principal Analytics Platform Architect at Qlik and is part of the Presales organization. He has been with Qlik for 8 years, and specializes in integration, architecture, embedding, and security. Take it away Dan!
Sheet and object-level access control in Qlik Cloud
This is a relatively common request, especially from customers coming from Qlik Sense Enterprise Client-Managed. The use case is when organizations want to show/hide specific assets in an application based on the group membership of the current user that is accessing the application. Note that this is in no way a strategy or solution for data security (which is handled with section access), but rather serves as a potential design pattern for custom tailoring apps for specific groups of users.
Example Scenario
Let’s assume a customer has a global sales application. That application contains sheets that are designed for specific product group sales that not every sales representative sells. The customer wants to show the product-specific sheets only to the sales representatives that sell those respective products. If the user contains the group “Product Group A” then they should see the “Product Group A Analysis” sheet, and likewise if the user contains the group “Product Group B” then they should contain the “Product Group B Analysis” sheet.
Solution
To achieve this in Qlik Cloud, we can use the Advanced Analytics connector, which in essence is a RESTful server-side extension. This connector offers the ability to connect to RESTful services in real-time from both the load script and from the front-end (charts and expressions). We can use this connector to connect directly to the Qlik Cloud APIs to fetch the groups of the current user, return those groups as a pipe-delimited string, and then use those groups in a show condition expression.
Setup
Prerequisites:
Connector Setup:
Sample App Testing:
The sample application includes three sheets:
The application transforms the OsUser() result into the subject format, looks up the user, gets the groups, and returns them as a pipe-delimited string. You can find this process defined in the vUserSub and vUserGroups variables.
To test the application, first confirm that the first sheet returns your user groups. If it does, you can modify the sheet calculation conditions on the latter two sheets to your desired group names that you want to show based on.
Modify the expression by uncommenting it and adding in your desired group name (ensured it is enclosed by pipes so as to not partially match another group name):
In my example, I am a member of the group `Product Group A’ and not `Product Group B’, so while in edit mode, I see the following, confirming the ‘Product Group B Analysis’ is hidden from my view:
Exiting edit mode, I now see:
Additional Notes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.