diff --git a/HighLevelReqs.md b/HighLevelReqs.md index 4c43eb4..ead20a1 100644 --- a/HighLevelReqs.md +++ b/HighLevelReqs.md @@ -177,7 +177,7 @@ At any level, an override is only permitted if the attribute has **not been lock - Areas support **parent-child relationships** (e.g., Plant → Building → Production Line → Cell). - Each instance is assigned to an area within its site. - Areas are used for **filtering and finding instances** in the central UI. -- Area definitions are managed by users with the **Admin** role. +- Area definitions are managed by users with the **Design** role. ### 3.11 Pre-Deployment Validation @@ -394,7 +394,7 @@ The central cluster hosts a **configuration and management UI** (no live machine ### 9.3 Roles - **Admin**: System-wide permission to manage sites, data connections, LDAP group-to-role mappings, API keys, and system-level configuration. -- **Design**: System-wide permission to author and edit templates, scripts, shared scripts, external system definitions, notification lists, and inbound API method definitions. +- **Design**: System-wide permission to author and edit templates, scripts, shared scripts, external system definitions, notification lists, inbound API method definitions, and area definitions. - **Deployment**: Permission to manage instances (create, set overrides, bind connections, disable, delete) and deploy configurations to sites. Also triggers system-wide artifact deployment. Can be scoped **per site**. ### 9.4 Role Scoping diff --git a/src/ScadaLink.CentralUI/Auth/AuthEndpoints.cs b/src/ScadaLink.CentralUI/Auth/AuthEndpoints.cs index 5e8263b..a638f51 100644 --- a/src/ScadaLink.CentralUI/Auth/AuthEndpoints.cs +++ b/src/ScadaLink.CentralUI/Auth/AuthEndpoints.cs @@ -86,6 +86,13 @@ public static class AuthEndpoints context.Response.Redirect("/login"); }).DisableAntiforgery(); + // GET /logout — allows direct navigation to logout (redirects to login after sign-out) + endpoints.MapGet("/logout", async (HttpContext context) => + { + await context.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); + return Results.Redirect("/login"); + }); + return endpoints; } } diff --git a/src/ScadaLink.CentralUI/Components/Layout/NavMenu.razor b/src/ScadaLink.CentralUI/Components/Layout/NavMenu.razor index 297c058..570b02d 100644 --- a/src/ScadaLink.CentralUI/Components/Layout/NavMenu.razor +++ b/src/ScadaLink.CentralUI/Components/Layout/NavMenu.razor @@ -23,9 +23,6 @@ - @@ -45,6 +42,9 @@ + @@ -90,11 +90,13 @@ -
- @context.User.FindFirst("DisplayName")?.Value -
- -
+
+
+ @context.User.FindFirst("DisplayName")?.Value +
+ +
+
diff --git a/src/ScadaLink.CentralUI/Components/Pages/Admin/Areas.razor b/src/ScadaLink.CentralUI/Components/Pages/Admin/Areas.razor index e0f9263..c93df3a 100644 --- a/src/ScadaLink.CentralUI/Components/Pages/Admin/Areas.razor +++ b/src/ScadaLink.CentralUI/Components/Pages/Admin/Areas.razor @@ -3,7 +3,7 @@ @using ScadaLink.Commons.Entities.Instances @using ScadaLink.Commons.Entities.Sites @using ScadaLink.Commons.Interfaces.Repositories -@attribute [Authorize(Policy = AuthorizationPolicies.RequireAdmin)] +@attribute [Authorize(Policy = AuthorizationPolicies.RequireDesign)] @inject ISiteRepository SiteRepository @inject ITemplateEngineRepository TemplateEngineRepository diff --git a/src/ScadaLink.ManagementService/ManagementActor.cs b/src/ScadaLink.ManagementService/ManagementActor.cs index f409157..2d09834 100644 --- a/src/ScadaLink.ManagementService/ManagementActor.cs +++ b/src/ScadaLink.ManagementService/ManagementActor.cs @@ -74,13 +74,13 @@ public class ManagementActor : ReceiveActor { // Admin operations CreateSiteCommand or UpdateSiteCommand or DeleteSiteCommand - or CreateAreaCommand or DeleteAreaCommand or ListRoleMappingsCommand or CreateRoleMappingCommand or UpdateRoleMappingCommand or DeleteRoleMappingCommand or ListApiKeysCommand or CreateApiKeyCommand or DeleteApiKeyCommand => "Admin", // Design operations - CreateTemplateCommand or UpdateTemplateCommand or DeleteTemplateCommand + CreateAreaCommand or DeleteAreaCommand + or CreateTemplateCommand or UpdateTemplateCommand or DeleteTemplateCommand or ValidateTemplateCommand or CreateExternalSystemCommand or UpdateExternalSystemCommand or DeleteExternalSystemCommand