Print Page | Close Window

Can we determine the client that started a save?

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2790
Printed Date: 24-Jan-2026 at 11:29am


Topic: Can we determine the client that started a save?
Posted By: samir
Subject: Can we determine the client that started a save?
Date 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
 
http://www.ideablade.com/forum/forum_posts.asp?TID=1424&PID=5161&title=can-we-determine-the-client-that-started-a-save#5161">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
http://www.ideablade.com/forum/forum_posts.asp?TID=1424&title=can-we-determine-the-client-that-started-a-save#top">Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 865
Post Options Post Options      Quote kimj http://www.ideablade.com/forum/new_reply_form.asp?M=Q&PID=5163&PN=1&TR=2 - Quote Post Reply http://www.ideablade.com/forum/new_reply_form.asp?PID=5163&PN=1&TR=2 - Reply http://www.ideablade.com/forum/forum_posts.asp?TID=1424&PID=5163&title=can-we-determine-the-client-that-started-a-save#5163">Direct 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.



Replies:
Posted By: sbelini
Date 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.


Posted By: samir
Date 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


Posted By: sbelini
Date Posted: 01-Jul-2011 at 8:32am
Samir,
 
I'd suggest using the the http://drc.ideablade.com/xwiki/bin/view/Documentation/push-notification - 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.



Print Page | Close Window