-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenuItem.cs
More file actions
32 lines (27 loc) · 1.13 KB
/
Copy pathMenuItem.cs
File metadata and controls
32 lines (27 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System.Collections.Generic;
namespace SimpleModule.Core.Menu;
public sealed class MenuItem
{
public required string Label { get; init; }
[System.Diagnostics.CodeAnalysis.SuppressMessage(
"Design",
"CA1056:URI-like properties should not be strings"
)]
public required string Url { get; init; }
public string Icon { get; init; } = "";
public int Order { get; init; }
public MenuSection Section { get; init; } = MenuSection.Navbar;
public bool RequiresAuth { get; init; } = true;
public string? Group { get; init; }
/// <summary>
/// When set, this menu item is only visible to users who have at least one of these roles.
/// An empty list means visible to all authenticated users.
/// </summary>
public IReadOnlyList<string> Roles { get; init; } = [];
/// <summary>
/// When set, this menu item is only visible to users whose permission claims
/// satisfy the requirement (supports wildcards via PermissionMatcher).
/// Admin role bypasses this check. Null means no permission gating.
/// </summary>
public string? RequiredPermission { get; init; }
}