Toosame.ManagementKit 1.0.1

dotnet add package Toosame.ManagementKit --version 1.0.1                
NuGet\Install-Package Toosame.ManagementKit -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Toosame.ManagementKit" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Toosame.ManagementKit --version 1.0.1                
#r "nuget: Toosame.ManagementKit, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Toosame.ManagementKit as a Cake Addin
#addin nuget:?package=Toosame.ManagementKit&version=1.0.1

// Install Toosame.ManagementKit as a Cake Tool
#tool nuget:?package=Toosame.ManagementKit&version=1.0.1                

Toosame.ManagementKit

    /// <summary>
    /// 系统菜单管理
    /// </summary>
    [ApiController]
    [Route("api/System/[controller]")]
    [MenuPath("/系统管理/菜单管理")]
    public class MenuController : ControllerBase
    {
        private readonly IHttpContextAccessor _httpContextAccessor;
        private readonly MenuPermissionManager _menuPermissionManager;

        public MenuController(IHttpContextAccessor httpContextAccessor,
            MenuPermissionManager menuPermissionManager)
        {
            _httpContextAccessor = httpContextAccessor;
            _menuPermissionManager = menuPermissionManager;
        }

        /// <summary>
        /// 获取系统菜单和权限树数据
        /// </summary>
        /// <returns></returns>
        [HttpGet, MenuAuditName("获取系统菜单和权限树")]
        public ActionResult<IEnumerable<MenuPermissonTreeNode>> Get()
        {
            return _menuPermissionManager.MenuPermissonTree.ToList();
        }

        /// <summary>
        /// 根据用户获取菜单列表
        /// </summary>
        /// <returns></returns>
        [HttpGet("User"), MenuAuditName("获取当前登录用户菜单树")]
        public ActionResult<IEnumerable<MenuPermissonTreeNode>> GetUserMenu()
        {
            string[] permission = _httpContextAccessor.HttpContext.User
                .FindAll(p => p.Type == nameof(MenuPermissonKind.Permisson))
                .Select(p => p.Value)
                .ToArray();
            if (!permission.Any())
                return Forbid();

            return _menuPermissionManager.GetTree(permission);
        }
    }
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 460 7/1/2022
1.0.0 410 12/14/2020