Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.
SOLVED

Gallery authentication pass thru to workflow

pvara
8 - Asteroid

I have a case where I have employee HR data, is there a way to have an app only display the "logged in" user for their data? PTO

Employee A is logged and can only view Employee A's Data.

 

 

Thank you

9 REPLIES 9
michael_treadwell
ACE Emeritus
ACE Emeritus

In 10.5 you can now choose to require a user to supply credentials with which the application will run on Gallery.

 

https://community.alteryx.com/t5/Analytics-Blog/Alteryx-Analytics-10-5-Introduces-New-Workflow-Execu...

patrick_digan
17 - Castor
17 - Castor

@pvara If you're in a private gallery setup (and perhaps using windows auth), you can use a text box interface tool and name it "__cloud:UserId" to get the user's ID. To get their name, you would have to then bring in the users table from the MongoDB.

 

Capture.PNG

jonriddle
8 - Asteroid

Hey Patrick,

 

Any thoughts on why this wouldn't work in a macro?  I have it working in an analytical app, but if I move that __cloud:UserId textbox into a macro, and then create a new analytical app that uses that macro, it no longer works.

 

Any help would be much appreciated.


Thanks,

 

Jon

 

Capture.PNG

patrick_digan
17 - Castor
17 - Castor

@jonriddle fascinating. I agree with you that it doesn't seem to work inside a macro. I can't seem to think of a way around it. You should submit it as a product idea and I would be glad to star it :)

jonriddle
8 - Asteroid
JoeS
Alteryx
Alteryx

Could you have your top level App work out the user ID using "__cloud:UserId" and then pass that through to the Text Box within the Macro?

jonriddle
8 - Asteroid

Thanks for the tip JoeS.  I made this change and have it working.  This at least gets the majority of the flow into the macro.  Hopefully we're able to get this into the macro sometime in the future to fully encapsulate the logic.

 

Thanks!

CiaranA
10 - Fireball

@patrick_digan Hi Patrick, this solution would be perfect for something i'm trying to achieve - Pulling user credentials of the user of the app to pass into the workflow and update a field. 

 

I'm struggling with configuring it however. 

 

Are you able to share a bit more detail on how each tool needs to be configured?

patrick_digan
17 - Castor
17 - Castor

@CiaranA 1) You'll need a text box interface tool named __cloud:UserId in the annotation tab:

Capture.PNG

When it's run in the gallery, this will return the ID for the user (5554f9... in the below) that matches what you would see from the admin page on the gallery if you select a user:

Capture2.PNG

2) In order to convert that ID to the user, you'll need to grab the users table from the MongoID like so:

Capture3.PNG

3) You would need to get the password (i believe the regular one works) from the alteryx system settings on the server machine:

Capture.PNG

 

4) This mongo table will include an _id field in the form of { "$oid" : "55953eab6c9f3a0c48e1f" }. You would then just need join that ID inside the quotes with the id from the text box interface tool.

5) Once joined, you would then have the firstname and lastname as fields.

 

Unless you open up your mongo on the sever to be queried remotely (and then change the mongo tool to use the IP address of the machine instead of localhost), you would have to do this work on the server machine itself. and the __cloud:userID only works when run from the gallery.