Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Michael_Reese
Employee
Employee

How to capture logged in user on qvs hosted app?

I need to be able to capture the user that is logged into the application when it's hosted on qvs.

I have a qvw that is reloaded from Publisher and it uses section access.  If I open the file directly (not on server), the section access works and an NTNAME field contains solely the username I have logged in with.  Someone else can log in and they see their account.  So that's all good.  However, if I reload it with Publisher and then open the file via qvp, it sees the service account that was used to do the reload, not the account that is logged in.

I've also tried to use osuer(), but that doesn't work in the onopen event on server either. 

Any help would be appreciated. 

Thanks

1 Solution

Accepted Solutions
Michael_Reese
Employee
Employee
Author

Thanks, all.  I figured it out.  Section Access was working but I needed to remove the service account from the currentuser table.  That allowed it to reduce to all other users and not get stuck on the service account that is used to reload the app through publisher..

View solution in original post

5 Replies
Miguel_Angel_Baeyens

Hi,

The OSUser() is the right one, since the NTNAME must follow the form this function returns (if you want to get the user logged in in section access, you can use QVUser() instead). But instead of using an action that may not trigger because of the client (some macros and triggers won't work when accesing via client) just create a new file with only a text object with

=OSUser()

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

Michael_Reese
Employee
Employee
Author

Osuser works after the onopen event on qvs.  It does not work during the event, which is what I need to do in order to set the correct landing tab.

What do you mean by creating a new file?  A new qvw?  Not sure how that would work when we're opening another qvw through the server.

Thanks

Miguel_Angel_Baeyens

Hello,

Has your section access a reduction field? Has the account running publisher permissions enough to read the AD? Does your document has checked the "Initial Data Reduction Based on Section Access" in the Document Properties in the Settings menu? That may cause unexpected results in the distribution task.

Back the file up before doing changes in section access since it may become unaccessable if something is set wrong in the code.

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

danielrozental
Master II
Master II

Maybe the user is accessing as anonymous? you should try disabling anonymous access in the QEMC, System, Server settings.

Michael_Reese
Employee
Employee
Author

Thanks, all.  I figured it out.  Section Access was working but I needed to remove the service account from the currentuser table.  That allowed it to reduce to all other users and not get stuck on the service account that is used to reload the app through publisher..