From 6f6ce058e246c04ebdecdbffdc82412779235328 Mon Sep 17 00:00:00 2001 From: LD-Reborn Date: Fri, 17 Oct 2025 18:32:22 +0200 Subject: [PATCH] Implemented navbar showing elements based on permissions --- src/Views/Shared/_Layout.cshtml | 48 ++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/src/Views/Shared/_Layout.cshtml b/src/Views/Shared/_Layout.cshtml index 20fc558..1f98dc8 100644 --- a/src/Views/Shared/_Layout.cshtml +++ b/src/Views/Shared/_Layout.cshtml @@ -1,4 +1,5 @@ @using Microsoft.AspNetCore.Mvc.Localization +@using System.Security.Claims @inject IViewLocalizer T @@ -32,23 +33,38 @@ - @if (User.Identity.IsAuthenticated) + @if (User.Identity?.IsAuthenticated ?? false) { - - - - - + @if (User.HasClaim(ClaimTypes.Role, "CanInventorize")) + { + + } + @if (User.HasClaim(ClaimTypes.Role, "CanManageAssets")) + { + + } + @if (User.HasClaim(ClaimTypes.Role, "CanManageLocations")) + { + + } + @if (User.HasClaim(ClaimTypes.Role, "CanManageUsers")) + { + + } + @if (User.HasClaim(ClaimTypes.Role, "CanManageGroups")) + { + + } }