Hardened Sandbox to cope with dbresets

This commit is contained in:
Rick Falkvinge
2014-11-19 04:20:16 +01:00
parent 00486d9790
commit 512d19b027
4 changed files with 52 additions and 4 deletions
+13 -1
View File
@@ -4,6 +4,7 @@ using System.Globalization;
using System.Threading;
using System.Web;
using Swarmops.Logic.Structure;
using Swarmops.Logic.Support;
using Swarmops.Logic.Swarm;
/// <summary>
@@ -92,7 +93,18 @@ public class CommonV5
int currentOrganizationId = Convert.ToInt32(organizationIdentityString);
result.CurrentUser = Person.FromIdentity(currentUserId);
result.CurrentOrganization = Organization.FromIdentity(currentOrganizationId);
try
{
result.CurrentOrganization = Organization.FromIdentity(currentOrganizationId);
}
catch (ArgumentException)
{
if (PilotInstallationIds.IsPilot(PilotInstallationIds.DevelopmentSandbox))
{
// It's possible this organization was deleted. Log on to Sandbox instead.
result.CurrentOrganization = Organization.Sandbox;
}
}
CommonV5.CulturePreInit(HttpContext.Current.Request);
// OnPreInit() isn't called in the static methods calling this fn
+13 -1
View File
@@ -4,6 +4,7 @@ using System.Web;
using Swarmops.Logic.Cache;
using Swarmops.Logic.Security;
using Swarmops.Logic.Structure;
using Swarmops.Logic.Support;
using Swarmops.Logic.Swarm;
/// <summary>
@@ -33,8 +34,19 @@ public class ControlV5Base : System.Web.UI.UserControl
currentUserId = Convert.ToInt32(userIdentityString);
currentOrganizationId = Convert.ToInt32(organizationIdentityString);
_currentUser = Person.FromIdentity(currentUserId);
_currentOrganization = Organization.FromIdentity(currentOrganizationId);
_authority = _currentUser.GetAuthority();
try
{
_currentOrganization = Organization.FromIdentity(currentOrganizationId);
}
catch (ArgumentException)
{
if (PilotInstallationIds.IsPilot(PilotInstallationIds.DevelopmentSandbox))
{
// It's possible this organization was deleted. Log on to Sandbox instead.
_currentOrganization = Organization.Sandbox;
}
}
base.OnLoad(e);
}
+13 -1
View File
@@ -4,6 +4,7 @@ using System.Web;
using Swarmops.Basic.Enums;
using Swarmops.Logic.Security;
using Swarmops.Logic.Structure;
using Swarmops.Logic.Support;
using Swarmops.Logic.Swarm;
/// <summary>
@@ -31,7 +32,18 @@ public class DataV5Base : System.Web.UI.Page
string organizationIdentityString = identityTokens[1];
this.CurrentUser = Person.FromIdentity(Int32.Parse(userIdentityString));
this.CurrentOrganization = Organization.FromIdentity(Int32.Parse(organizationIdentityString));
try
{
this.CurrentOrganization = Organization.FromIdentity(Int32.Parse(organizationIdentityString));
}
catch (ArgumentException)
{
if (PilotInstallationIds.IsPilot(PilotInstallationIds.DevelopmentSandbox))
{
// It's possible this organization was deleted. Log on to Sandbox instead.
this.CurrentOrganization = Organization.Sandbox;
}
}
}
else
{
+13 -1
View File
@@ -9,6 +9,7 @@ using System.Web.UI;
using System.Web.UI.WebControls;
using Swarmops.Logic.Security;
using Swarmops.Logic.Structure;
using Swarmops.Logic.Support;
using Swarmops.Logic.Swarm;
using Membership = Swarmops.Logic.Swarm.Membership;
@@ -32,7 +33,18 @@ namespace Swarmops
_currentUser = Person.FromIdentity(currentUserId);
_authority = _currentUser.GetAuthority();
_currentOrganization = Organization.FromIdentity(currentOrganizationId);
try
{
_currentOrganization = Organization.FromIdentity(currentOrganizationId);
}
catch (ArgumentException)
{
if (PilotInstallationIds.IsPilot(PilotInstallationIds.DevelopmentSandbox))
{
// It's possible this organization was deleted. Log on to Sandbox instead.
_currentOrganization = Organization.Sandbox;
}
}
}
protected void Page_Load(object sender, EventArgs e)