Qlik Community

QlikView Publisher

Discussion Board for collaboration on QlikView Publisher.

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
Employee
Employee

Re: How to capture logged in user on qvs hosted app?

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..

5 Replies
MVP
MVP

Re: How to capture logged in user on qvs hosted app?

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

Employee
Employee

Re: How to capture logged in user on qvs hosted app?

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

MVP
MVP

Re: How to capture logged in user on qvs hosted app?

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
Honored Contributor II

Re: How to capture logged in user on qvs hosted app?

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

Employee
Employee

Re: How to capture logged in user on qvs hosted app?

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..

Community Browser