From 5da876cbe2ffb5bce15015b320707c723b29d316 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Thu, 30 Apr 2015 13:51:26 +0200 Subject: [PATCH] Fixed so sysadmin can always log in --- Site5/Security/Login.aspx.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Site5/Security/Login.aspx.cs b/Site5/Security/Login.aspx.cs index 1a459a78..67381757 100644 --- a/Site5/Security/Login.aspx.cs +++ b/Site5/Security/Login.aspx.cs @@ -262,8 +262,6 @@ namespace Swarmops.Pages.Security Person authenticatedPerson = Authentication.Authenticate (credentialsLogin, credentialsPass); - // TODO: Determine last logged-on organization. Right now, log on to Sandbox. - int lastOrgId = authenticatedPerson.LastLogonOrganizationId; if (PilotInstallationIds.IsPilot (PilotInstallationIds.PiratePartySE) && (lastOrgId == 3 || lastOrgId == 0)) @@ -276,7 +274,10 @@ namespace Swarmops.Pages.Security lastOrgId = Organization.SandboxIdentity; } - if (!authenticatedPerson.MemberOfWithInherited (lastOrgId)) + Authority testAuthority = Authority.FromLogin (authenticatedPerson, + Organization.FromIdentity (lastOrgId)); + + if (!authenticatedPerson.MemberOfWithInherited (lastOrgId) && !testAuthority.HasSystemAccess (AccessType.Read)) { // If the person doesn't have access to the last organization (anymore), log on to Sandbox // unless first pilot, in which case throw (deny login)