Fix for unprecompiled Mono deployment

This commit is contained in:
Rick Falkvinge
2016-09-21 13:05:21 +02:00
parent 53129105c2
commit bb32cef024
+41 -2
View File
@@ -1,7 +1,5 @@
using System;
using System.Activities.Statements;
using System.Collections.Generic;
using System.EnterpriseServices.Internal;
using System.Linq;
using System.Web;
using System.Web.Services;
@@ -261,6 +259,29 @@ namespace Swarmops.Frontend.Automation
[WebMethod]
public static AjaxInputCallResult SetPersonEditorData(int personId, string field, string newValue)
{
AuthenticationData authData = GetAuthenticationDataAndCulture();
bool self = false;
if (personId == 0) // request self record
{
self = true; // may make use of this later
personId = authData.CurrentUser.Identity;
}
if (string.IsNullOrEmpty (newValue))
{
if (field != "TwitterId") // These fields may be set to empty; default is disallow
{
return new AjaxInputCallResult
{
Success = false,
DisplayMessage = Resources.Global.Global_FieldCannotBeEmpty,
FailReason = AjaxInputCallResult.ErrorInvalidFormat,
NewValue = GetPersonValue (personId, field)
};
}
}
return new AjaxInputCallResult
{
Success = true,
@@ -269,5 +290,23 @@ namespace Swarmops.Frontend.Automation
throw new NotImplementedException();
}
private static string GetPersonValue (int personId, string field)
{
Person person = Person.FromIdentity (personId);
switch (field)
{
case "Name":
return person.Name;
case "Mail":
return person.Mail;
case "Phone":
return person.Phone;
case "TwitterId":
return person.TwitterId;
default:
throw new NotImplementedException();
}
}
}
}