From 95bde642161c27c97eb68cd703ed46fc161a5c68 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 18 Jan 2026 19:33:05 +0000 Subject: [PATCH 1/4] Initial plan From 903f16c6f4ada7821ccd8f6211f868f37a428746 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 18 Jan 2026 19:36:18 +0000 Subject: [PATCH 2/4] Add Access Denied page with user-friendly design Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com> --- .../Common/Helpers.cs | 6 ++ .../Components/Pages/AccessDenied.razor | 79 +++++++++++++++++++ .../Permissions/AuthorizedComponentBase.cs | 3 +- 3 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 EstateManagementUI.BlazorServer/Components/Pages/AccessDenied.razor diff --git a/EstateManagementUI.BlazorServer/Common/Helpers.cs b/EstateManagementUI.BlazorServer/Common/Helpers.cs index bda45aef..f3107921 100644 --- a/EstateManagementUI.BlazorServer/Common/Helpers.cs +++ b/EstateManagementUI.BlazorServer/Common/Helpers.cs @@ -150,6 +150,12 @@ public static void NavigateToErrorPage(this NavigationManager navigationManager) { navigationManager.NavigateTo("/error", replace: true); } + + public static void NavigateToAccessDeniedPage(this NavigationManager navigationManager) + { + navigationManager.NavigateTo("/access-denied", replace: true); + } + public static void NavigateToEntryPage(this NavigationManager navigationManager) { navigationManager.NavigateTo("/entry", replace: true); diff --git a/EstateManagementUI.BlazorServer/Components/Pages/AccessDenied.razor b/EstateManagementUI.BlazorServer/Components/Pages/AccessDenied.razor new file mode 100644 index 00000000..2430616a --- /dev/null +++ b/EstateManagementUI.BlazorServer/Components/Pages/AccessDenied.razor @@ -0,0 +1,79 @@ +@page "/access-denied" +@inject IConfiguration Configuration + +Access Denied + +
+
+
+
+ +
+
+ + + +
+
+ + +

Access Denied

+ + +

+ You don't have permission to access this page or perform this action. + If you believe this is an error, please contact your administrator. +

+ + +
+
+ + + +
+

Why am I seeing this?

+

+ Your current role or permissions do not allow access to this resource. + Contact your system administrator to request the necessary permissions. +

+
+
+
+ + +
+ + + + + Go to Home + + +
+ + +
+

+ Need help? Contact your administrator or support team at + @SupportEmail +

+
+
+
+
+
+ +@code { + private string SupportEmail { get; set; } = "support@example.com"; + + protected override void OnInitialized() + { + SupportEmail = Configuration.GetValue("AppSettings:SupportEmail", "support@example.com") ?? "support@example.com"; + } +} diff --git a/EstateManagementUI.BlazorServer/Components/Permissions/AuthorizedComponentBase.cs b/EstateManagementUI.BlazorServer/Components/Permissions/AuthorizedComponentBase.cs index dd90846b..da0751a9 100644 --- a/EstateManagementUI.BlazorServer/Components/Permissions/AuthorizedComponentBase.cs +++ b/EstateManagementUI.BlazorServer/Components/Permissions/AuthorizedComponentBase.cs @@ -28,8 +28,7 @@ protected async Task RequirePermission(PermissionSection permissionSection, Perm Boolean hasPermission = await this.PermissionService.HasPermissionAsync(permissionSection, permissionFunction); if (hasPermission == false) { - // TODO: Navigate to access denied page - this.NavigationManager.NavigateToErrorPage(); + this.NavigationManager.NavigateToAccessDeniedPage(); return; } } From 3214ed7d1aaba3affcc686b31bbf7e0e2eaf01eb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 18 Jan 2026 19:39:21 +0000 Subject: [PATCH 3/4] Extract support email constant and improve code quality Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com> --- .../Components/Pages/AccessDenied.razor | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/EstateManagementUI.BlazorServer/Components/Pages/AccessDenied.razor b/EstateManagementUI.BlazorServer/Components/Pages/AccessDenied.razor index 2430616a..34b4828c 100644 --- a/EstateManagementUI.BlazorServer/Components/Pages/AccessDenied.razor +++ b/EstateManagementUI.BlazorServer/Components/Pages/AccessDenied.razor @@ -70,10 +70,11 @@ @code { - private string SupportEmail { get; set; } = "support@example.com"; + private const string DefaultSupportEmail = "support@example.com"; + private string SupportEmail { get; set; } = DefaultSupportEmail; protected override void OnInitialized() { - SupportEmail = Configuration.GetValue("AppSettings:SupportEmail", "support@example.com") ?? "support@example.com"; + SupportEmail = Configuration.GetValue("AppSettings:SupportEmail", DefaultSupportEmail) ?? DefaultSupportEmail; } } From f88c6dcfdca21f3d3840a1405fbfa240b8e9d677 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 18 Jan 2026 19:40:43 +0000 Subject: [PATCH 4/4] Remove redundant null-coalescing operator Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com> --- .../Components/Pages/AccessDenied.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EstateManagementUI.BlazorServer/Components/Pages/AccessDenied.razor b/EstateManagementUI.BlazorServer/Components/Pages/AccessDenied.razor index 34b4828c..2df0ecee 100644 --- a/EstateManagementUI.BlazorServer/Components/Pages/AccessDenied.razor +++ b/EstateManagementUI.BlazorServer/Components/Pages/AccessDenied.razor @@ -75,6 +75,6 @@ protected override void OnInitialized() { - SupportEmail = Configuration.GetValue("AppSettings:SupportEmail", DefaultSupportEmail) ?? DefaultSupportEmail; + SupportEmail = Configuration.GetValue("AppSettings:SupportEmail", DefaultSupportEmail); } }