Re-fixes: U4-4211 User without media section permission will be logged out immediately when accessing a document type using a media picker datatype (u7.0.3)

This commit is contained in:
Shannon
2014-05-09 14:06:15 +10:00
parent 0382902984
commit 389724cba5
14 changed files with 378 additions and 192 deletions

View File

@@ -10,6 +10,7 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Xml;
using Newtonsoft.Json;
using Umbraco.Core.Configuration;
using System.Web.Security;
using Umbraco.Core.Strings;
@@ -52,6 +53,28 @@ namespace Umbraco.Core
|| (input.StartsWith("[") && input.EndsWith("]"));
}
/// <summary>
/// Returns a JObject/JArray instance if the string can be converted to json, otherwise returns the string
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
internal static object ConvertToJsonIfPossible(this string input)
{
if (input.DetectIsJson() == false)
{
return input;
}
try
{
var obj = JsonConvert.DeserializeObject(input);
return obj;
}
catch (Exception ex)
{
return input;
}
}
internal static string ReplaceNonAlphanumericChars(this string input, char replacement)
{
//any character that is not alphanumeric, convert to a hyphen