Completes: U4-459 Public Access permissions not set on distributed servers
This commit is contained in:
@@ -143,24 +143,18 @@ namespace Umbraco.Web.Cache
|
||||
// the unpublishing event handles that, and for examine with unpublished content indexes, we want to keep that data
|
||||
// in the index, it's not until it's complete deleted that we want to remove it.
|
||||
|
||||
//SD: We are not using this, i was going to use this for the PublicAccessCacheRefresher but we need
|
||||
// to store the public access in the db otherwise we're gonna end up with problems in certain LB
|
||||
// scenarios
|
||||
|
||||
////public access events
|
||||
//Access.AfterSave += Access_AfterSave;
|
||||
//public access events
|
||||
Access.AfterSave += Access_AfterSave;
|
||||
}
|
||||
|
||||
//SD: We are not using this, i was going to use this for the PublicAccessCacheRefresher but we need
|
||||
// to store the public access in the db otherwise we're gonna end up with problems in certain LB
|
||||
// scenarios
|
||||
#region Public access event handlers
|
||||
|
||||
//#region Public access event handlers
|
||||
//static void Access_AfterSave(Access sender, SaveEventArgs e)
|
||||
//{
|
||||
// DistributedCache.Instance.RefreshPublicAccess();
|
||||
//}
|
||||
//#endregion
|
||||
static void Access_AfterSave(Access sender, SaveEventArgs e)
|
||||
{
|
||||
DistributedCache.Instance.RefreshPublicAccess();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Content service event handlers
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Umbraco.Web.Cache
|
||||
public const string StylesheetPropertyCacheRefresherId = "2BC7A3A4-6EB1-4FBC-BAA3-C9E7B6D36D38";
|
||||
public const string DataTypeCacheRefresherId = "35B16C25-A17E-45D7-BC8F-EDAB1DCC28D2";
|
||||
public const string DictionaryCacheRefresherId = "D1D7E227-F817-4816-BFE9-6C39B6152884";
|
||||
//public const string PublicAccessCacheRefresherId = "1DB08769-B104-4F8B-850E-169CAC1DF2EC";
|
||||
public const string PublicAccessCacheRefresherId = "1DB08769-B104-4F8B-850E-169CAC1DF2EC";
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -7,75 +7,71 @@ using Umbraco.Core.Cache;
|
||||
|
||||
namespace Umbraco.Web.Cache
|
||||
{
|
||||
//SD: We are not using this, i was going to use this for the PublicAccessCacheRefresher but we need
|
||||
// to store the public access in the db otherwise we're gonna end up with problems in certain LB
|
||||
// scenarios
|
||||
public sealed class PublicAccessCacheRefresher : JsonCacheRefresherBase<PublicAccessCacheRefresher>
|
||||
{
|
||||
#region Static helpers
|
||||
|
||||
//public sealed class PublicAccessCacheRefresher : JsonCacheRefresherBase<PublicAccessCacheRefresher>
|
||||
//{
|
||||
// #region Static helpers
|
||||
internal static JsonPayload DeserializeFromJsonPayload(string json)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<JsonPayload>(json);
|
||||
}
|
||||
|
||||
// internal static JsonPayload DeserializeFromJsonPayload(string json)
|
||||
// {
|
||||
// return JsonConvert.DeserializeObject<JsonPayload>(json);
|
||||
// }
|
||||
internal static string SerializeToJsonPayload(XmlDocument doc)
|
||||
{
|
||||
return JsonConvert.SerializeObject(FromXml(doc));
|
||||
}
|
||||
|
||||
// internal static string SerializeToJsonPayload(XmlDocument doc)
|
||||
// {
|
||||
// return JsonConvert.SerializeObject(FromXml(doc));
|
||||
// }
|
||||
internal static JsonPayload FromXml(XmlDocument doc)
|
||||
{
|
||||
if (doc == null) return null;
|
||||
|
||||
// internal static JsonPayload FromXml(XmlDocument doc)
|
||||
// {
|
||||
// if (doc == null) return null;
|
||||
var payload = new JsonPayload
|
||||
{
|
||||
XmlContent = doc.OuterXml
|
||||
};
|
||||
return payload;
|
||||
}
|
||||
|
||||
// var payload = new JsonPayload
|
||||
// {
|
||||
// XmlContent = doc.OuterXml
|
||||
// };
|
||||
// return payload;
|
||||
// }
|
||||
#endregion
|
||||
|
||||
// #endregion
|
||||
#region Sub classes
|
||||
|
||||
// #region Sub classes
|
||||
internal class JsonPayload
|
||||
{
|
||||
public string XmlContent { get; set; }
|
||||
}
|
||||
|
||||
// internal class JsonPayload
|
||||
// {
|
||||
// public string XmlContent { get; set; }
|
||||
// }
|
||||
#endregion
|
||||
|
||||
// #endregion
|
||||
protected override PublicAccessCacheRefresher Instance
|
||||
{
|
||||
get { return this; }
|
||||
}
|
||||
|
||||
// protected override PublicAccessCacheRefresher Instance
|
||||
// {
|
||||
// get { return this; }
|
||||
// }
|
||||
public override Guid UniqueIdentifier
|
||||
{
|
||||
get { return new Guid(DistributedCache.PublicAccessCacheRefresherId); }
|
||||
}
|
||||
|
||||
// public override Guid UniqueIdentifier
|
||||
// {
|
||||
// get { return new Guid(DistributedCache.PublicAccessCacheRefresherId); }
|
||||
// }
|
||||
public override string Name
|
||||
{
|
||||
get { return "Public access cache refresher"; }
|
||||
}
|
||||
|
||||
// public override string Name
|
||||
// {
|
||||
// get { return "Public access cache refresher"; }
|
||||
// }
|
||||
public override void Refresh(string jsonPayload)
|
||||
{
|
||||
if (jsonPayload.IsNullOrWhiteSpace()) return;
|
||||
var deserialized = DeserializeFromJsonPayload(jsonPayload);
|
||||
if (deserialized == null) return;
|
||||
var xDoc = new XmlDocument();
|
||||
xDoc.LoadXml(deserialized.XmlContent);
|
||||
ClearCache(xDoc);
|
||||
base.Refresh(jsonPayload);
|
||||
}
|
||||
|
||||
// public override void Refresh(string jsonPayload)
|
||||
// {
|
||||
// if (jsonPayload.IsNullOrWhiteSpace()) return;
|
||||
// var deserialized = DeserializeFromJsonPayload(jsonPayload);
|
||||
// if (deserialized == null) return;
|
||||
// var xDoc = new XmlDocument();
|
||||
// xDoc.LoadXml(deserialized.XmlContent);
|
||||
// ClearCache(xDoc);
|
||||
// base.Refresh(jsonPayload);
|
||||
// }
|
||||
|
||||
// private void ClearCache(XmlDocument xDoc)
|
||||
// {
|
||||
// Access.Reload(xDoc);
|
||||
// }
|
||||
//}
|
||||
private void ClearCache(XmlDocument xDoc)
|
||||
{
|
||||
Access.UpdateInMemoryDocument(xDoc);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,29 +95,26 @@ namespace umbraco.cms.businesslogic.web
|
||||
new Access().FireAfterAddMemberShipRoleToDocument(new Document(documentId), role, e);
|
||||
}
|
||||
|
||||
//SD: We are not using this, i was going to use this for the PublicAccessCacheRefresher but we need
|
||||
// to store the public access in the db otherwise we're gonna end up with problems in certain LB
|
||||
// scenarios
|
||||
|
||||
//internal static void Reload(XmlDocument newDoc)
|
||||
//{
|
||||
// //NOTE: This would be better to use our normal ReaderWriter lock but because we are emitting an
|
||||
// // event inside of the WriteLock and code can then listen to the event and call this method we end
|
||||
// // up in a dead-lock. This specifically happens in the PublicAccessCacheRefresher.
|
||||
// //So instead we use the load locker which is what is used for the static XmlDocument instance, we'll
|
||||
// // lock that, set the doc to null which will cause any reader threads to block for the AccessXml instance
|
||||
// // then save the doc and re-load it, then all blocked threads can carry on.
|
||||
// lock(LoadLocker)
|
||||
// {
|
||||
// _accessXmlContent = null;
|
||||
|
||||
// newDoc.Save(_accessXmlSource);
|
||||
|
||||
// _accessXmlContent = new XmlDocument();
|
||||
// _accessXmlContent.Load(_accessXmlSource);
|
||||
// ClearCheckPages();
|
||||
// }
|
||||
//}
|
||||
/// <summary>
|
||||
/// Used to refresh cache among servers in an LB scenario
|
||||
/// </summary>
|
||||
/// <param name="newDoc"></param>
|
||||
internal static void UpdateInMemoryDocument(XmlDocument newDoc)
|
||||
{
|
||||
//NOTE: This would be better to use our normal ReaderWriter lock but because we are emitting an
|
||||
// event inside of the WriteLock and code can then listen to the event and call this method we end
|
||||
// up in a dead-lock. This specifically happens in the PublicAccessCacheRefresher.
|
||||
//So instead we use the load locker which is what is used for the static XmlDocument instance, we'll
|
||||
// lock that, set the doc to null which will cause any reader threads to block for the AccessXml instance
|
||||
// then save the doc and re-load it, then all blocked threads can carry on.
|
||||
lock (LoadLocker)
|
||||
{
|
||||
_accessXmlContent = null;
|
||||
_accessXmlContent = new XmlDocument();
|
||||
_accessXmlContent.LoadXml(newDoc.OuterXml);
|
||||
ClearCheckPages();
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)]
|
||||
public static void AddMemberGroupToDocument(int DocumentId, int MemberGroupId)
|
||||
|
||||
Reference in New Issue
Block a user