In python Webapp pass global variable of person logged in and interacting with the app

Solved!
jordan_sklansky
Level 2
In python Webapp pass global variable of person logged in and interacting with the app

Hi Everyone,

I did look through existing discussions and I have not see exactly the answer I'm looking for. Either in a python notebook, and by extension a python Webapp, I would like to grab the DSS user id that is currently logged in and interacting with the webapp in a variable.

My use case, is I created a webapp where someone can interact with a row of data from an existing table, and I want to pass their user id as a variable into a column in the psycopg insert statement so when I add a record of the row in a new table, I have a record of who did it.

Any help appreciated!!!

Thanks,

Jordan

0 Kudos
2 Solutions
Turribeach

That's correct associatedDSSUser is the Run As user and userForImpersonation is the logged web user. You must have the WebApp set to Run backend as = Last modifier. This is not ideal and you probably want to have a separate generic account to run WebApps. 

View solution in original post

3 Replies
jordan_sklansky
Level 2
Author

Hi @Turribeach,

Awesome, thank you https://doc.dataiku.com/dss/latest/webapps/security.html explained it perfectly. Do you know the difference between 'associatedDSSUser' and 'userForImpersonation'. I see my userID in both. Which one would be the person logged in and interacting with the web-app? I see the documentation further talks about impersonating a user, so I'm assuming associatedDSSUser is the one logged in but just checking.

Thanks!

Jordan

0 Kudos
Turribeach

That's correct associatedDSSUser is the Run As user and userForImpersonation is the logged web user. You must have the WebApp set to Run backend as = Last modifier. This is not ideal and you probably want to have a separate generic account to run WebApps.