New Posts New Posts RSS Feed: Can we determine the client that started a save?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Can we determine the client that started a save?

 Post Reply Post Reply
Author
samir View Drop Down
Newbie
Newbie


Joined: 30-Mar-2011
Posts: 14
Post Options Post Options   Quote samir Quote  Post ReplyReply Direct Link To This Post Topic: Can we determine the client that started a save?
    Posted: 22-Jun-2011 at 2:18pm
Hello,
 
I have the exact same problem as the user below, but in my case the answer given by kimj isn´t satisfatory because my system should allow multiple persons logging in with the same Principal. Is there any workaround?
 
Thanks,
Samir
 
Direct Link To This Post Topic: Can we determine the client that started a save?
Posted: 14-Aug-2009 at 12:10am
Hi,
We need to find a unique Identifier for the Client from which the SaveChanges originated. In the OnSaving and OnSaved methods on the Server we do see a SessionKey, but that is not the UserToken we use in the PushNotification. How can we determine from which Client the Save originated?
We would like to send this Identifier allong to all Clients. That way the Client from which the SaveChanges originated, knows it does not have to do anything when it receives the Push Notification from the server with it's own Id in the message. All other Clients will refetch the changed Entities (and handle concurrency) on receiving the Push Notification.
Regards,
Paul Sinnema
Diartis AG


Edited by Sinnema - 14-Aug-2009 at 12:16am
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 865
Post Options Post Options      Quote kimj Quote Post ReplyReplyDirect Link To This Post Posted: 14-Aug-2009 at 7:09am
The Principal of the user doing the save is available to the OnSaving and OnSaved event handlers (you can also always obtain it from the thread for the duration of the request on the server). The Principal is also always available on the client, either from EntityManager.Principal or the thread. It might be the best way of uniquely identifying each client, or maybe useful in a mapping of Principals to UserTokens.
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 23-Jun-2011 at 11:40am
Hi samir,
I'm more than one client is using the same Principal, in theory they'd all be the same.
Can you elaborate your question? If they all use the same Principal, what differentiates one from another?
Silvio.
Back to Top
samir View Drop Down
Newbie
Newbie


Joined: 30-Mar-2011
Posts: 14
Post Options Post Options   Quote samir Quote  Post ReplyReply Direct Link To This Post Posted: 24-Jun-2011 at 7:00am
Hi Silvio,
 
For example suppose you have an username shared by multiple sales managers. They would all use the same Principal but in fact are different users using the system. If one of these users modifies an Entity, I´d like to send a notification to all the others but not to the user that started the Save. Another option would be to send to everyone a notification containing an identifier of the entity manager that started the save so I could check on the client-side and discard it if it was me that started it.
 
Am I making myself clear?
 
Thanks,
Samir
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 01-Jul-2011 at 8:32am
Samir,
 
I'd suggest using the the Push Notification and having all clients subscribe to this service. Then once the notification is received, the client would check if it was it who generated started the operation and then act appropriately.
 
In your case, you'd need something other than the Principal to identify the user. (i.e. IP)
Have you created a custom IPrincipal where you have this 'something else' that would differentiate one 'user' from another?
I still think that the best/simplest approach would be having different users with the same role.
 
Silvio.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down