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...

-