diff --git a/src/vue/api/BootstrapAdmin.Api/Controllers/MenusController.cs b/src/vue/api/BootstrapAdmin.Api/Controllers/MenusController.cs index bb96555c..4883094b 100644 --- a/src/vue/api/BootstrapAdmin.Api/Controllers/MenusController.cs +++ b/src/vue/api/BootstrapAdmin.Api/Controllers/MenusController.cs @@ -2,10 +2,7 @@ // Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information. // Website: https://admin.blazor.zone -using Bootstrap.Admin.Query; -using Bootstrap.DataAccess; using Bootstrap.Security; -using Longbow.Web.Mvc; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; @@ -21,72 +18,6 @@ namespace Bootstrap.Admin.Controllers.Api [ApiController] public class MenusController : ControllerBase { - /// - /// 获得所有菜单列表调用 - /// - /// - /// - [HttpGet] - public QueryData Get([FromQuery]QueryMenuOption value) - { - return value.RetrieveData(User.Identity!.Name); - } - /// - /// 保存菜单调用 - /// - /// - [HttpPost] - [ButtonAuthorize(Url = "~/Admin/Menus", Auth = "add,edit")] - public bool Post([FromBody]BootstrapMenu value) - { - return MenuHelper.Save(value); - } - - /// - /// 删除菜单调用 - /// - /// - [HttpDelete] - [ButtonAuthorize(Url = "~/Admin/Menus", Auth = "del")] - public bool Delete([FromBody]IEnumerable value) - { - return MenuHelper.Delete(value); - } - - /// - /// 角色管理菜单授权按钮调用 - /// - /// 角色ID - /// type=role时,角色管理菜单授权调用;type=user时,菜单管理编辑页面父类菜单按钮调用 - /// - [HttpPost("{id}")] - public IEnumerable Post(string id, [FromQuery]string type) - { - IEnumerable ret = new List(); - switch (type) - { - case "role": - ret = MenuHelper.RetrieveMenusByRoleId(id); - break; - case "user": - ret = MenuHelper.RetrieveMenus(User.Identity!.Name); - break; - } - return ret; - } - - /// - /// 角色管理菜单授权保存按钮调用 - /// - /// 菜单ID - /// 角色ID集合 - /// - [HttpPut("{id}")] - [ButtonAuthorize(Url = "~/Admin/Menus", Auth = "assignRole")] - public bool Put(string id, [FromBody]IEnumerable roleIds) - { - return RoleHelper.SavaByMenuId(id, roleIds); - } } } diff --git a/src/vue/api/BootstrapAdmin.Api/Controllers/RolesController.cs b/src/vue/api/BootstrapAdmin.Api/Controllers/RolesController.cs index 71b1f64b..59ad933d 100644 --- a/src/vue/api/BootstrapAdmin.Api/Controllers/RolesController.cs +++ b/src/vue/api/BootstrapAdmin.Api/Controllers/RolesController.cs @@ -2,9 +2,6 @@ // Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information. // Website: https://admin.blazor.zone -using Bootstrap.Admin.Query; -using Bootstrap.DataAccess; -using Longbow.Web.Mvc; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; @@ -22,70 +19,5 @@ namespace Bootstrap.Admin.Controllers.Api [ApiController] public class RolesController : ControllerBase { - /// - /// 获取所有角色数据 - /// - /// - /// - [HttpGet] - public QueryData Get([FromQuery]QueryRoleOption value) - { - return value.RetrieveData(); - } - /// - /// 通过指定用户ID/部门ID/菜单ID获得所有角色集合,已经授权的有checked标记 - /// - /// 用户ID/部门ID/菜单ID - /// 类型 - /// - [HttpPost("{id}")] - public IEnumerable Post(string id, [FromQuery]string type) - { - var ret = type switch - { - "user" => RoleHelper.RetrievesByUserId(id), - "group" => RoleHelper.RetrievesByGroupId(id), - "menu" => RoleHelper.RetrievesByMenuId(id), - _ => new Role[0] - }; - return ret.Select(m => new { m.Id, m.Checked, m.RoleName, m.Description }); - } - /// - /// 保存角色授权方法 - /// - /// 角色ID - /// 选中的ID集合 - /// type=menu时,菜单维护页面对角色授权弹框保存按钮调用 - /// - [HttpPut("{id}")] - [ButtonAuthorize(Url = "~/Admin/Roles", Auth = "assignUser,assignGroup,assignMenu,assignApp")] - public bool Put(string id, [FromBody]IEnumerable values, [FromQuery]string type) => type switch - { - "user" => UserHelper.SaveByRoleId(id, values), - "group" => GroupHelper.SaveByRoleId(id, values), - "menu" => MenuHelper.SaveMenusByRoleId(id, values), - "app" => AppHelper.SaveByRoleId(id, values), - _ => false - }; - /// - /// 保存角色方法 - /// - /// - [HttpPost] - [ButtonAuthorize(Url = "~/Admin/Roles", Auth = "add,edit")] - public bool Post([FromBody]Role value) - { - return RoleHelper.Save(value); - } - /// - /// 删除角色方法 - /// - /// - [HttpDelete] - [ButtonAuthorize(Url = "~/Admin/Roles", Auth = "del")] - public bool Delete([FromBody]IEnumerable value) - { - return RoleHelper.Delete(value); - } } } diff --git a/src/vue/api/BootstrapAdmin.Api/Controllers/UsersController.cs b/src/vue/api/BootstrapAdmin.Api/Controllers/UsersController.cs index c62ccb05..c1f06bc4 100644 --- a/src/vue/api/BootstrapAdmin.Api/Controllers/UsersController.cs +++ b/src/vue/api/BootstrapAdmin.Api/Controllers/UsersController.cs @@ -30,9 +30,9 @@ namespace BootstrapAdmin.Api.Controllers /// /// [HttpGet] - public ActionResult> Get() + public IActionResult Get() { - return UserService.GetAll(); + return new JsonResult(new { Code = "0", Message = "login successed!", Result = new { roles = Array.Empty() } }) ; } ///