/// <summary> /// [MVC] 角色管理-新增角色界面 /// </summary> /// <returns></returns> // GET: Roles/Create public async Task <IActionResult> Create() { try { // 1. 权限检查 if (!await RoleOrgPerManager.HasPermissionInSelfOrg(SignUser.Id, Constants.ROLE_CREATE_VIEW)) { Logger.Warn($"[{nameof(Create)}] 用户[{SignUser.SignName}]({SignUser.Id})没有权限({Constants.ROLE_CREATE_VIEW})"); ModelState.AddModelError("All", "没有权限"); return(RedirectToAction(nameof(Index))); } } catch (Exception e) { Logger.Error($"[{nameof(Create)}] 服务器错误: \r\n{e.ToString()}"); ModelState.AddModelError("All", e.Message); return(RedirectToAction(nameof(Index))); } // 1. 权限检查 return(View()); }
/// <summary> /// 创建 /// </summary> /// <returns></returns> // GET: Permission/Create public async Task <IActionResult> Create() { try { // 1. 权限验证 if (!await RoleOrgPerManager.HasPermissionInSelfOrg(SignUser.Id, Constants.PER_MANAGE)) { ModelState.AddModelError("All", "没有权限"); ViewData["AllErr"] = "没有权限"; return(RedirectToAction(nameof(Index))); } return(View()); } catch (Exception e) { Logger.Error($"[{nameof(Details)}] 服务器错误:\r\n{e}"); return(RedirectToAction(nameof(Index))); } }