gorepj01
gorepj01

Reputation: 55

Delphi: Datasnap Identifying User from Server Methods Unit

How can I determine the User that initiated one of my functions that I have created in my Server Methods Unit?

Upvotes: 0

Views: 1312

Answers (2)

skamradt
skamradt

Reputation: 15538

Just use TDSSessionManager.GetThreadSession.Username if you have authentication enabled.

Upvotes: 0

Wait4U
Wait4U

Reputation: 56

in the ServerContainerUnit or WebModuleUnit (ISAPI),


DSAuthenticationManager.onUserAuthenticate procedure or TDSServer.onConnect ect...,


use TDSSessionManager.GetThreadSession.PutData('UserName',User); identify current user to DSSession,


in your Servermethods unit functions, you can use TDSSessionManager.GetThreadSession.GetData('UserName')from the DSSession what you saved onUserAuthenticate or other procedure.


Tested on DataSnap REST ISAPI, work fine.

Upvotes: 1

Related Questions