diff --git a/Common/Enums/ObjectOptionalDataType.cs b/Common/Enums/ObjectOptionalDataType.cs index fc777ca0..16855eda 100644 --- a/Common/Enums/ObjectOptionalDataType.cs +++ b/Common/Enums/ObjectOptionalDataType.cs @@ -251,6 +251,16 @@ namespace Swarmops.Common.Enums /// OrgTemporaryAccessListRead, + /// + /// If defined, will autologin to read "open ledgers" when accessed through this domain + /// + OrgOpenLedgersDomain, + + /// + /// If defined, will login to this organization when accessed through this domain (credentials still required) + /// + OrgVanityDomain, + /// /// Free-text description of an inbound invoice (what's it for?) /// diff --git a/Logic/Structure/Organization.cs b/Logic/Structure/Organization.cs index 3d9bb2ca..510a931c 100644 --- a/Logic/Structure/Organization.cs +++ b/Logic/Structure/Organization.cs @@ -54,6 +54,42 @@ namespace Swarmops.Logic.Structure return new Organization (basic); } + public static Organization FromOpenLedgersDomain(string domain) + { + int[] organizationIds = SwarmDb.GetDatabaseForReading().GetObjectsByOptionalData(ObjectType.Organization, ObjectOptionalDataType.OrgOpenLedgersDomain, domain); + + if (organizationIds.Length < 1) + { + return null; + } + else if (organizationIds.Length == 1) + { + return Organization.FromIdentity(organizationIds[0]); + } + else + { + throw new InvalidOperationException("Invalid state: multiple organizations with same open-ledgers domain"); + } + } + + public static Organization FromVanityDomain(string domain) + { + int[] organizationIds = SwarmDb.GetDatabaseForReading().GetObjectsByOptionalData(ObjectType.Organization, ObjectOptionalDataType.OrgVanityDomain, domain); + + if (organizationIds.Length < 1) + { + return null; + } + else if (organizationIds.Length == 1) + { + return Organization.FromIdentity(organizationIds[0]); + } + else + { + throw new InvalidOperationException("Invalid state: multiple organizations with same vanity domain"); + } + } + #endregion private ObjectOptionalData _optionalData; @@ -902,5 +938,7 @@ namespace Swarmops.Logic.Structure return new DateTime (year, 12, 31, 23, 59, 59, 999); } + + } } \ No newline at end of file diff --git a/Logic/Swarm/Person.cs b/Logic/Swarm/Person.cs index 8ef80fdf..3cc6d9a7 100644 --- a/Logic/Swarm/Person.cs +++ b/Logic/Swarm/Person.cs @@ -1134,5 +1134,10 @@ namespace Swarmops.Logic.Swarm return false; } + + // A couple of special cases + + public const int OpenLedgersIdentity = -1; + } } \ No newline at end of file diff --git a/Site5/App_GlobalResources/Pages.Ledgers.resx b/Site5/App_GlobalResources/Pages.Ledgers.resx index 8c28b248..fdd9c578 100644 --- a/Site5/App_GlobalResources/Pages.Ledgers.resx +++ b/Site5/App_GlobalResources/Pages.Ledgers.resx @@ -601,4 +601,12 @@ Total Tax + + Viewing/Editing Transaction #<span id="spanModalTransactionId">67890</span> + The transaction id is replaced client-side on display + + + Inspecting Transaction #<span id="spanModalTransactionId">12345</span> + The transaction id is replaced client-side on display + \ No newline at end of file diff --git a/Site5/App_GlobalResources/Pages.Security.resx b/Site5/App_GlobalResources/Pages.Security.resx index edb69a75..36196375 100644 --- a/Site5/App_GlobalResources/Pages.Security.resx +++ b/Site5/App_GlobalResources/Pages.Security.resx @@ -175,6 +175,10 @@ Lockdown Ticket + + <strong>OPEN LEDGERS</strong><br/><br/>{0} is running Open Ledgers. This means that anybody may inspect the financial reports and bookkeeping. You have been logged on to the organization's Operations to do just that. + The {0} is the organization name. + <strong>BitId two-factor authentication is now enabled.</strong><br/><br/>From now on, you can use your bitcoin wallet to log in (and will <strong>need</strong> to do so). Thank you for enabling added security.<br/><br/>Please remember to keep your phone secure with a password, too. diff --git a/Site5/Pages/v5/Ledgers/InspectLedgers.aspx b/Site5/Pages/v5/Ledgers/InspectLedgers.aspx index e7f16ff9..9f29a3ec 100644 --- a/Site5/Pages/v5/Ledgers/InspectLedgers.aspx +++ b/Site5/Pages/v5/Ledgers/InspectLedgers.aspx @@ -35,10 +35,12 @@ // Enable various actions on icon $('img.LocalIconFlag').click(function () { + transactionId = $(this).attr("txId"); onFlagTransaction("Add Tx Id here"); }); $('img.LocalIconInspect').click(function () { - onInspectTransaction("Add Tx Id here"); + transactionId = $(this).attr("txId"); + onInspectTransaction(transactionId); }); } }); @@ -51,10 +53,23 @@ reloadData(); }); + $("#IconCloseEdit").click(function () { + $('#divModalCover').fadeOut(); + + if (transactionDirty) { + $('#tableAccountPlan').treegrid('reload'); + transactionDirty = false; + } + }); + + + $('div.datagrid').css('opacity', 0.4); }); var accountId = 0; + var transactionId = 0; + var transactionDirty = false; function onAccountSelected(newAccountId) { accountId = newAccountId; @@ -75,6 +90,10 @@ } function onInspectTransaction(transactionId) { + window.scrollTo(0, 0); + $('body').css('overflow-y', 'hidden'); + $('#divModalCover').fadeIn(); + alertify.log (''); } @@ -123,6 +142,36 @@ + + +
+ +
+ diff --git a/Site5/Pages/v5/Ledgers/InspectLedgers.aspx.cs b/Site5/Pages/v5/Ledgers/InspectLedgers.aspx.cs index cbbba8f3..f3defe58 100644 --- a/Site5/Pages/v5/Ledgers/InspectLedgers.aspx.cs +++ b/Site5/Pages/v5/Ledgers/InspectLedgers.aspx.cs @@ -70,6 +70,14 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers this.LabelFlagNotAvailable.Text = Resources.Pages.Ledgers.InspectLedgers_FlaggingNotAvailable; this.LabelInspectNotAvailable.Text = Resources.Pages.Ledgers.InspectLedgers_InspectNotAvailable; + + // if write access + + this.LiteralEditHeader.Text = Resources.Pages.Ledgers.InspectLedgers_EditingTransactionX; + + // else if read access + + this.LiteralEditHeader.Text = Resources.Pages.Ledgers.InspectLedgers_InspectingTransactionX; } } } \ No newline at end of file diff --git a/Site5/Pages/v5/Ledgers/Json-InspectLedgerData.aspx.cs b/Site5/Pages/v5/Ledgers/Json-InspectLedgerData.aspx.cs index bd554fb5..858f1226 100644 --- a/Site5/Pages/v5/Ledgers/Json-InspectLedgerData.aspx.cs +++ b/Site5/Pages/v5/Ledgers/Json-InspectLedgerData.aspx.cs @@ -155,7 +155,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers runningBalance += row.AmountCents; string actionHtml = String.Format ( - " ", + " ", row.FinancialTransactionId.ToString (CultureInfo.InvariantCulture)); result.Append ("{" + String.Format ( diff --git a/Site5/Security/Login.aspx.cs b/Site5/Security/Login.aspx.cs index eae0d56d..1e76223f 100644 --- a/Site5/Security/Login.aspx.cs +++ b/Site5/Security/Login.aspx.cs @@ -68,10 +68,13 @@ namespace Swarmops.Pages.Security } } + string requestHost = Request.Url.Host; + + // If this is the Dev Sandbox, autologin - if (Request.Url.Host == "dev.swarmops.com" && + if (requestHost == "dev.swarmops.com" && PilotInstallationIds.IsPilot (PilotInstallationIds.DevelopmentSandbox) && Request.QueryString["SuppressAutologin"] != "true") { @@ -82,6 +85,16 @@ namespace Swarmops.Pages.Security Response.Redirect ("/"); } + // If we're on an Open Ledgers domain, autologin as Open Ledgers + + Organization organization = Organization.FromOpenLedgersDomain(requestHost); // returns null if doesn't exist + + if (organization != null) + { + Response.AppendCookie(new HttpCookie("DashboardMessage", HttpUtility.UrlEncode(Resources.Pages.Security.Login_AsOpenLedgers))); + FormsAuthentication.SetAuthCookie(Person.OpenLedgersIdentity.ToString() + "," + organization.Identity.ToString(), true); + } + // Check for SSL and force it // Special case for CloudFlare deployments - there is a case where somebody will get their connections de-SSLed at the server diff --git a/Site5/Style/style-v5.css b/Site5/Style/style-v5.css index 2a42a4a6..5230bd89 100644 --- a/Site5/Style/style-v5.css +++ b/Site5/Style/style-v5.css @@ -371,6 +371,19 @@ body.rtl .sidebar { } +.divIconCloseModal { + float:right; + margin-top: 2px; + margin-right: -5px +} + + +body.rtl .divIconCloseModal { + float:left; + margin-top: 2px; + margin-left: -5px +} + /* LOGINBOX */