Skip to content
Philipp Frenzel edited this page Dec 19, 2013 · 26 revisions

General

QlikView Rights depends on two types of user rights:

  1. The frontend user rights which are defining the visibility of objects to the user
  2. The backend user rights which are restricting the data by "section access"

Frontend Rights

Introduction

The visibility of objects in QlikView can be set to "true" or "false" by value or expression. So to make it managable, we need to create a dynamic expression, that will hold the information of the current user, the object included into the document and the information if he has the rights or not.

Folder Structure

To get rights running, you need to define the values for some variables, which will be used by the macros to load and write data. As the solution reads from the -prj folder, you need to create one for the document you wanna manage with rights. The running macros will create some folders, so pls. be prepared to find folder with the prefix "_rights" - if you wanna take a look inside, pls. be prepared that you need to be a skilled developer, to understand what is happening inside. As we use the files inside the "_rights"-folders to store settings, users, etc. a change or delete can be complete "kill" for the system.

Setting the formulas

The "creation" of the visibility formula is created by a macro called loop sheets. As you execute it, it will loop through the whole qlikview document, check all objects based on each sheet and if possible write the "visibility" to the objects. The string for the comparision looks like:

=if(only({<RightRule={'$(=OSUser())Document\SH04_789130639Document\CH01_016245194'}>} RightAccess)=1,1,0)

Based upon the settings of the Administrator the "RightRule"-field will contain a matching string where the OSUser() ist filled by the user rights definition.

Installation

To setup the system, you need to "include" all needed scripts and macros to your document. <<TODO: needs to be described more in detail>>

After this is done, you need to go to the settings section and work on the initial settings for your qlikview document:

SET varDocumentFormula = "DocumentName()"; SET varSheetFormula = "GetActiveSheetId()"; SET varCurrentUser = "OSUser()"; SET varNTDomain = "FRENZELSRV2008"; SET varFileXLSRights = ".\RightsAdmin.xlsx"; SET varStringDocumentName = "=DocumentName()"; SET varStringQVDocumentPath = "TestSources\"; SET varStringQVDocument = "Weather"; Let pstrExpObject = 'CH01_016245194'; Let pstrExpPath = replace(DocumentPath(),DocumentName(),'') & '_rights_' & varStringQVDocument; Let pstrFileName = num(now());

The first you need to set, is the document, you wanna add to your rights and the path if not located in the same directory. In most scenarios, this can be "blank" by default.

  1. varStringDocumentName = "YOURAPP";
  2. varStringDocumentNamePath = "";

Based upon these settings, the script will create the needed folders automatically in your qlikview document root. If the script crashes, it might be, that you have forgotten to add the vba macro "isFolder" to your internal macros.

  1. varNTDomain = "YOURDOMAIN";

You need to setup this correctly, as the link between OSUser, OrgUnit and the rights logic is comparing the domain exactly.

By reloading the script all default foders and files will be generated again, so even if you delete the sub folders and the files within, rights will work but your data is gone!

Generated Folders:

  • _rights_DOCUMENTNAME
  • _rigths_DOCUMENTNAME_backbone

And the gernerated template files:

  • _rights_DOCUMENTNAME_rights_template.qvd
  • _rigths_DOCUMENTNAME_backbone\InternalUserGroup.qvd

By the first reload of the document, an InternalUserGroup_Auto.qvd will be created too, but it's not mandantory to run the app, it stores the user data.

Macros

Export Helper

For the export we use the build in ExportEx-function which has the following export types:

set cs = ActiveDocument.GetSheetObject("CS03") cs.ServerSideExportEx "C:\test.html" , ";" , 0 '0=HTML, 1=Text, 2=Bitmap, 3=XML, 4=QVD, 5=BIFF