Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Restrict Access to Data in QVW document

Hi

I have a requirement where i need to restrict the data depending on the user's windows login. Depending on which user has logged in I have to fetch the data from the db and display only that data in qvw reports. I used OSUser() function in the load script and made a db query to fetch the data accordingly. The problem that i am facing is that once this qvw is loaded and published, the user details get saved somehow in the qvw document. So when this document is viewed from an url by some other user ,that user's login is not reflected and the data is not fetched accordling. I understand that becuase i am fetching all the data in script only on the load of the document the user's login details are fetched and appropriate data is loaded and since in the web view of the document load does not  happen results are not as desired.

Can somebody suggest me a solution or another approach to this problem ?

Thanks

Ashwini

6 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

Please check the attached file for solution.  To open the file use the following credentials

User Name : Admin

Password : password

This file filters the data based on the logged in user.

Hope this helps you.

Regards,

jagan.

Not applicable
Author

Hi jagan,

Thank you for the reply. My problem is slightly complex. I want to know the userId of the logged in user and check it against my apllications's database and determine if he is an admin or a VP of a department or just a member of the department. Depending on his role the access to the data should be provide. Now if i use NTNAME in section access how do i access this userid and check it against my application's  database

Thanks

Ashwini

jagan
Luminary Alumni
Luminary Alumni

Hi,

To get logged in user name you can use

=QVUser()

But I am not sure about the Role of the logged in user.

Regards,

Jagan.

Not applicable
Author

Thank you for the reply. I will try using QvUser() and then figure out a way to get the role.

anderslinden
Partner - Contributor III
Partner - Contributor III

Hi! In a HR application I use NTName in section acces to restrict data depending on logged on user in the network. Fist I set a general password (not necessary but an extra security if they leave their PCs on) with * as NTName. Then I concatenati in all relevant NTusers from a table (in my case a service, but that's irrelevant).In section application I then have a table with all NTUsers and the costcenters they are allowed to see. Also this from a service in my case and subfield command, but it could be a normal table of course). It works in the server environment for me. Hope this helps. I'm sure it could be done better, but it works.

Section Access;

STAR IS *;

LOAD * INLINE [

USERID, PASSWORD, SERIAL, ACCESS, NTNAME

*, hrstat, *, USER,*

];

concatenate load

'ASKONT\'&DepartmentCode as NTNAME

FROM [http://bisrv/PBHRSecurity/webservices/GetDepartments.aspx] (XmlSimple, Table is [Departments/Department]);

section application;

star is *;

HRSecurity:

load

'ASKONT\'&DepartmentCode as NTNAME,

DepartmentName as UserDescription,

subfield(Comments,';') as HRSecurityKst

FROM [http://bisrv/PBHRSecurity/webservices/GetTargetValues.aspx] (XmlSimple, Table is [TargetValues/TargetValue]);

BI Consultant, Business Information Providers
www.bipab.se
jagan
Luminary Alumni
Luminary Alumni

Hi,

I think there is no built-in function to retrieve the access(Role) of a user in Qlikview.  You can do this by using by arriving an extra mapping table with UserName and Access columns which is used in Section Acess. 

By using the only() we can get the Role of the user.

Regards,

Jagan.