Fixed so sysadmin can always log in

This commit is contained in:
Rick Falkvinge
2015-04-30 13:51:26 +02:00
parent 9b4c9af475
commit 5da876cbe2
+4 -3
View File
@@ -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)