zeroframework/Services/DeviceCenter/ZeroFramework.DeviceCenter.Application/PermissionProviders/PermissionPermissionDefinitionProvider.cs

21 lines
1.1 KiB
C#
Raw Normal View History

2023-12-05 09:22:48 +00:00
using Microsoft.Extensions.Localization;
using System.Reflection;
using ZeroFramework.DeviceCenter.Application.Services.Permissions;
namespace ZeroFramework.DeviceCenter.Application.PermissionProviders
{
public class PermissionPermissionDefinitionProvider(IStringLocalizerFactory factory) : IPermissionDefinitionProvider
{
private readonly IStringLocalizer _localizer = factory.Create("Permissions.MyPermissions", Assembly.GetExecutingAssembly().FullName ?? string.Empty);
public void Define(PermissionDefinitionContext context)
{
var productGroup = context.AddGroup(PermissionPermissions.GroupName, _localizer["Permission:PermissionManager"]);
var productManagement = productGroup.AddPermission(PermissionPermissions.Permissions.Default, _localizer["Permission:PermissionManager.Permissions"]);
productManagement.AddChild(PermissionPermissions.Permissions.Get, _localizer["Permission:PermissionManager.Permissions.Get"]);
productManagement.AddChild(PermissionPermissions.Permissions.Edit, _localizer["Permission:PermissionManager.Permissions.Edit"]);
}
}
}