1
0
mirror of https://github.com/chylex/Minecraft-Phantom-Panel.git synced 2024-11-22 08:42:44 +01:00
Minecraft-Phantom-Panel/Server/Phantom.Server.Web.Identity/Authorization/PermissionView.razor

22 lines
521 B
Plaintext

@using Microsoft.AspNetCore.Components.Authorization
@using Phantom.Server.Web.Identity.Data
@inject PermissionManager PermissionManager
<AuthorizeView>
<Authorized>
@if (ChildContent != null && PermissionManager.CheckPermission(context.User, Permission)) {
@ChildContent(context)
}
</Authorized>
</AuthorizeView>
@code {
[Parameter, EditorRequired]
public Permission Permission { get; set; } = null!;
[Parameter]
public RenderFragment<AuthenticationState>? ChildContent { get; set; }
}