diff --git a/Logic/Logic.csproj b/Logic/Logic.csproj
index 2d4106ae..772f1684 100644
--- a/Logic/Logic.csproj
+++ b/Logic/Logic.csproj
@@ -64,6 +64,7 @@
+
diff --git a/Logic/Pirates/Person.cs b/Logic/Pirates/Person.cs
index 8dd544fc..0a4b28cc 100644
--- a/Logic/Pirates/Person.cs
+++ b/Logic/Pirates/Person.cs
@@ -1009,5 +1009,36 @@ namespace Activizr.Logic.Pirates
{
return GetAvatarLink(pixelSize).Replace("http://www", "https://secure");
}
+
+ public bool HasAccess (Access access)
+ {
+ if (access == null)
+ {
+ return true;
+ }
+
+ bool result = false;
+
+ // TODO: Build access control list from org chart, compare against required access
+
+ // For now, return true if Anna, Janne, or Rick. Bad hack, bad, really bad.
+
+ if (this.Identity == 2)
+ {
+ return true;
+ }
+
+ if (this.Identity == 11443)
+ {
+ return true;
+ }
+
+ if (this.Identity == 378)
+ {
+ return true;
+ }
+
+ return result;
+ }
}
}
\ No newline at end of file
diff --git a/Logic/Security/Accesses.cs b/Logic/Security/Accesses.cs
new file mode 100644
index 00000000..11a0ac75
--- /dev/null
+++ b/Logic/Security/Accesses.cs
@@ -0,0 +1,49 @@
+using Activizr.Basic.Enums;
+using Activizr.Logic.Structure;
+
+namespace Activizr.Logic.Security
+{
+ public class Access
+ {
+ public Access (AccessAspect aspect, AccessType type)
+ {
+ this.Aspect = aspect;
+ this.Type = type;
+ }
+
+ public Access(Organization organization, AccessAspect aspect, AccessType type)
+ {
+ this.Organization = organization;
+ this.Aspect = aspect;
+ this.Type = type;
+ }
+
+ public Access(Organization organization, Geography geography, AccessAspect aspect, AccessType type)
+ {
+ this.Organization = organization;
+ this.Geography = geography;
+ this.Aspect = aspect;
+ this.Type = type;
+ }
+
+ public readonly Organization Organization;
+ public readonly Geography Geography;
+ public readonly AccessAspect Aspect;
+ public readonly AccessType Type;
+ }
+
+
+ public enum AccessAspect
+ {
+ Unknown = 0,
+ Bookkeeping,
+ Financials
+ }
+
+ public enum AccessType
+ {
+ Unknown = 0,
+ Read,
+ Write
+ }
+}
diff --git a/Site5/App_Code/PageV5Base.cs b/Site5/App_Code/PageV5Base.cs
index 83a5d076..a95b143e 100644
--- a/Site5/App_Code/PageV5Base.cs
+++ b/Site5/App_Code/PageV5Base.cs
@@ -17,6 +17,7 @@ using Activizr.Logic.Structure;
public class PageV5Base : System.Web.UI.Page
{
public PermissionSet pagePermissionDefault = new PermissionSet(Permission.CanSeeSelf); //Use from menu;
+ public Access PageAccessRequired = null; // v5 mechanism
public Person _currentUser = null;
public Authority _authority = null;
@@ -109,10 +110,20 @@ public class PageV5Base : System.Web.UI.Page
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
-
-
base.OnPreInit(e);
}
+
+ protected override void OnPreRender(EventArgs e)
+ {
+ // Check security of page against users's credentials
+
+ if (!_currentUser.HasAccess (this.PageAccessRequired))
+ {
+ Response.Redirect("/Pages/v5/Security/AccessDenied.aspx");
+ }
+
+ base.OnPreRender(e);
+ }
}
diff --git a/Site5/Images/Icons/iconshock-disconnect-16px-hot.png b/Site5/Images/Icons/iconshock-disconnect-16px-hot.png
new file mode 100644
index 00000000..8f564ebb
Binary files /dev/null and b/Site5/Images/Icons/iconshock-disconnect-16px-hot.png differ
diff --git a/Site5/Images/Icons/iconshock-disconnect-16px.png b/Site5/Images/Icons/iconshock-disconnect-16px.png
new file mode 100644
index 00000000..3c7ea7cf
Binary files /dev/null and b/Site5/Images/Icons/iconshock-disconnect-16px.png differ
diff --git a/Site5/Images/Icons/iconshock-disconnect-96px.png b/Site5/Images/Icons/iconshock-disconnect-96px.png
new file mode 100644
index 00000000..ee94b3b6
Binary files /dev/null and b/Site5/Images/Icons/iconshock-disconnect-96px.png differ
diff --git a/Site5/Images/PageIcons/iconshock-disconnect-40px.png b/Site5/Images/PageIcons/iconshock-disconnect-40px.png
new file mode 100644
index 00000000..e2d9022d
Binary files /dev/null and b/Site5/Images/PageIcons/iconshock-disconnect-40px.png differ
diff --git a/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx b/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx
index 4e81c3a4..5f5cf716 100644
--- a/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx
+++ b/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx
@@ -116,14 +116,14 @@ div.BankUploadInstructionsImage
-
-
+
+
- >
-
+ >
+
@@ -133,30 +133,30 @@ div.BankUploadInstructionsImage
-
+
Todo...
-
+
>
-
-
-
-
+
+
+
+
-
+
-
+
diff --git a/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx.cs b/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx.cs
index ebac6fd3..23c48ebf 100644
--- a/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx.cs
+++ b/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx.cs
@@ -5,6 +5,7 @@ using System.Web.UI;
using System.Web.UI.WebControls;
using Activizr.Basic.Enums;
using Activizr.Logic.Financial;
+using Activizr.Logic.Security;
using Telerik.Web.UI;
using Telerik.Web.UI.Upload;
@@ -19,6 +20,7 @@ namespace Activizr.Site.Pages.Ledgers
{
this.PageTitle = Resources.Pages.Ledgers.UploadBankFiles_PageTitle;
this.PageIcon = "iconshock-bank";
+ this.PageAccessRequired = new Access(_currentOrganization, AccessAspect.Bookkeeping, AccessType.Write);
this.LabelSidebarInfo.Text = Resources.Pages.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Pages.Global.Sidebar_Actions;
@@ -106,6 +108,8 @@ namespace Activizr.Site.Pages.Ledgers
protected void Submit_Click(object sender, EventArgs e)
{
+ bool fileWasUploaded = false;
+
foreach (string fileInputID in Request.Files)
{
UploadedFile file = UploadedFile.FromHttpPostedFile(Request.Files[fileInputID]);
@@ -113,41 +117,52 @@ namespace Activizr.Site.Pages.Ledgers
{
// TODO: PROCESS
// file.SaveAs("c:\\temp\\" + file.GetName());
+ RadProgressContext progress = RadProgressContext.Current;
+ progress.Speed = "N/A";
+
+ const int total = 100;
+
+ for (int i = 0; i < total; i++)
+ {
+ progress["PrimaryPercent"] = i.ToString();
+ progress["PrimaryTotal"] = total.ToString();
+ progress["PrimaryValue"] = i.ToString();
+
+ progress["SecondaryTotal"] = total.ToString();
+ progress["SecondaryValue"] = i.ToString();
+ progress["SecondaryPercent"] = i.ToString();
+ progress["PrimaryProgressBar"] = i.ToString();
+ progress["CurrentOperationText"] = "File is being processed...";
+
+ if (!Response.IsClientConnected)
+ {
+ //Cancel button was clicked or the browser was closed, so stop processing
+ break;
+ }
+
+ //Stall the current thread for 0.1 seconds
+ System.Threading.Thread.Sleep(100);
+ }
+
+ this.PanelFileTypeAccount.Visible = false;
+ this.PanelResults.Visible = true;
+ fileWasUploaded = true;
}
-
}
- RadProgressContext progress = RadProgressContext.Current;
- progress.Speed = "N/A";
-
- const int total = 100;
-
- for (int i = 0; i < total; i++)
+ if (!fileWasUploaded)
{
- progress["PrimaryPercent"] = i.ToString();
- progress["PrimaryTotal"] = total.ToString();
- progress["PrimaryValue"] = i.ToString();
+ // If no file was uploaded, re-show the instructions div
- progress["SecondaryTotal"] = total.ToString();
- progress["SecondaryValue"] = i.ToString();
- progress["SecondaryPercent"] = i.ToString();
- progress["PrimaryProgressBar"] = i.ToString();
- progress["CurrentOperationText"] = "File is being processed...";
-
- if (!Response.IsClientConnected)
- {
- //Cancel button was clicked or the browser was closed, so stop processing
- break;
- }
-
- //Stall the current thread for 0.1 seconds
- System.Threading.Thread.Sleep(100);
+ this.LabelNoFileUploaded.Text = "Please upload a file LOC";
+ this.LiteralDivInstructionsStyle.Text = "style='display:inline'";
+ }
+ else
+ {
+ this.LabelNoFileUploaded.Text = string.Empty;
+ this.LiteralDivInstructionsStyle.Text = "style='display:none'";
}
-
- this.PanelFileTypeAccount.Visible = false;
- this.PanelResults.Visible = true;
-
}
}
}
\ No newline at end of file
diff --git a/Site5/Pages/v5/Security/AccessDenied.aspx b/Site5/Pages/v5/Security/AccessDenied.aspx
new file mode 100644
index 00000000..26002ef2
--- /dev/null
+++ b/Site5/Pages/v5/Security/AccessDenied.aspx
@@ -0,0 +1,23 @@
+<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="AccessDenied.aspx.cs" Inherits="Security_AccessDenied" %>
+
+
+
+
+
+ Access Denied [LOC]
+
+
+
Todo: Assist in changing organizations.
+
+
+
+
+
+
+
+
+
diff --git a/Site5/Pages/v5/Security/AccessDenied.aspx.cs b/Site5/Pages/v5/Security/AccessDenied.aspx.cs
new file mode 100644
index 00000000..b454f346
--- /dev/null
+++ b/Site5/Pages/v5/Security/AccessDenied.aspx.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+public partial class Security_AccessDenied : PageV5Base
+{
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ this.PageTitle = "Access Denied [LOC]";
+ this.PageIcon = "iconshock-disconnect";
+ }
+}
\ No newline at end of file