Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 36 additions & 30 deletions Server/Core/Security/Controls/BlogPermissionsGrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -423,49 +423,54 @@ protected override ArrayList GetUsers()
/// -----------------------------------------------------------------------------
protected override void LoadViewState(object savedState)
{
if (savedState == null)
{
return;
}

if (savedState != null)
var myState = savedState as object[];
if (myState == null || myState.Length < 4)
{
// Load State from the array of objects that was saved with SaveViewState.
return;
}

object[] myState = (object[])savedState;
// Do not restore dynamically generated child-control ViewState.
// The permissions grid is rebuilt on each request from the persisted permission data.

// Load Base Controls ViewState
if (myState[0] != null)
{
base.LoadViewState(myState[0]);
}
if (myState[1] != null)
{
_BlogID = Convert.ToInt32(myState[1]);
}

// Load BlogID
if (myState[1] != null)
{
BlogID = Convert.ToInt32(myState[1]);
}
if (myState[2] != null)
{
_currentUserId = Convert.ToInt32(myState[2]);
}

if (myState[2] != null)
{
CurrentUserId = Convert.ToInt32(myState[2]);
}
if (myState[3] != null)
{
var arrPermissions = new ArrayList();
string state = Convert.ToString(myState[3]);

// Load BlogPermissions
if (myState[3] != null)
if (!string.IsNullOrEmpty(state))
{
var arrPermissions = new ArrayList();
string state = Convert.ToString(myState[3]);
if (!string.IsNullOrEmpty(state))
string[] permissionKeys = state.Split(
new[] { "##" },
StringSplitOptions.RemoveEmptyEntries);

foreach (string key in permissionKeys)
{
// First Break the String into individual Keys
string[] permissionKeys = state.Split("##".ToCharArray());
foreach (string key in permissionKeys)
string[] settings = key.Split('|');

if (settings.Length >= 7)
{
string[] Settings = key.Split('|');
ParsePermissionKeys(Settings, arrPermissions);
ParsePermissionKeys(settings, arrPermissions);
}
}
_BlogPermissions = new BlogPermissionCollection(arrPermissions);
}
}

_BlogPermissions = new BlogPermissionCollection(arrPermissions);
}
}

/// -----------------------------------------------------------------------------
Expand All @@ -483,7 +488,8 @@ protected override object SaveViewState()

var allStates = new object[4];

allStates[0] = base.SaveViewState();
// Persist only the permission data, not the generated child-control ViewState.
allStates[0] = null;
allStates[1] = BlogID;
allStates[2] = CurrentUserId;

Expand Down