Set user during an applyEdits operation

3174
6
12-17-2015 10:35 AM
AlexMagruder
New Contributor III

I am exploring Editor Tracking and how it can be used in our production environment. Our arcgis server (10.1) is set to windows authentication which is bound to our companies User Directory. So when we create a web app for external clients, users cannot login using the IdentityManager. All gis services are routed through a proxy and authentication is handled by our windows server using forms authentication. This causes all applyEdits to be tracked as Esri_Anonymous. Is there a way to set the user for an applyEdits operation without using the IdentityManager?

Thanks for the help!!

0 Kudos
6 Replies
RobertScheitlin__GISP
MVP Emeritus

Alex,

   Do you have access to the user info from the forms authentication? If so then you can add a before-apply-edits event handler and place the user name into the data using code.

0 Kudos
AlexMagruder
New Contributor III

Robert,

I've given this a try but no luck. The applyEdits operation sets both the created_user and last_edited_user to an empty string.

Thanks,

Alex

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Alex,

   With out you manually providing the user info in code I would expect them to be empty. As I mentioned in my previous post if you have access to the user info from your forms authentication you can manually add that info using the before-apply-edits event

0 Kudos
AlexMagruder
New Contributor III

Here is a snippet of code where I manually set the Editor Tracking user info. When I look at the request being sent to the server all Editor Tracking fields were removed from the graphics. 

var userName = "Alex Magruder";
var userEdits = {
   created_user: userName,
   last_edited_user: userName
};
on(layer, "before-apply-edits", function(data){
  data.adds.forEach(function(graphic){
       lang.mixin(graphic.attributes, userEdits);
  });
});

Graphic after before-apply-editsApplyEdits request form data
{"attributes":{
  "OfflineID":null,
  "Comments":null,
  "Value1":null,
  "created_user":"Alex Magruder",
  "last_edited_user":"Alex Magruder"
}}
{"attributes":{
  "OfflineID":null,
  "Comments":null,
  "Value1":null
}}
0 Kudos
JordanBaumgardner
Occasional Contributor III

We add this to our main page to make it easy for the JS

    @{string userName = User.Identity.Name;}

    @Html.Hidden("hfUserName", userName)

0 Kudos
AbdulMateen
New Contributor

hi,

I am in to same issue ,did you find any solution?

Thanks & Regards

0 Kudos