Gets more validation bits wired up. Server side validation is now working which is based on val-server-field since we can use this natively with the asp.net ModelState result instead of the val-server which is actually to be used with PropertyType (Property Editors). Next up is validation for the different tabs of the editor.

This commit is contained in:
Shannon
2015-10-08 17:13:38 +02:00
parent 97c352030a
commit c477f7a840
18 changed files with 149 additions and 36 deletions

View File

@@ -0,0 +1,20 @@
using System;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Validation;
namespace Umbraco.Web.WebApi
{
/// <summary>
/// Applying this attribute to any webapi controller will ensure that it only contains one json formatter compatible with the angular json vulnerability prevention.
/// </summary>
internal class PrefixlessBodyModelValidatorAttribute : Attribute, IControllerConfiguration
{
public virtual void Initialize(HttpControllerSettings controllerSettings, HttpControllerDescriptor controllerDescriptor)
{
//replace the normal validator with our custom one for this controller
controllerSettings.Services.Replace(typeof(IBodyModelValidator),
new PrefixlessBodyModelValidator(controllerSettings.Services.GetBodyModelValidator()));
}
}
}