public async Task <Result> ModifyHidden([FromBody] ModifyStatusRequestDto dto) { if (!HttpContext.User.IsSuperRole()) { return(Result.ReFailure(ResultCodes.RoleNotSuperFailed)); } var server = _serviceProvider.GetRequiredService <MenuService>(); var result = await server.Get(dto.Id); if (!result.Success) { return(Result.ReFailure(result.Message, result.Status)); } result.Data.MenuHidden = dto.Status; return(await _serviceProvider.GetRequiredService <MenuService>().Modify(result.Data)); }
public async Task <Result> ModifyStatus([FromBody] ModifyStatusRequestDto dto) { var server = _serviceProvider.GetRequiredService <RoleService>(); long?tenancyId = HttpContext.User.IsSuperRole() ? null : Convert.ToInt64(HttpContext.User.TenancyId()); var result = await server.Get(dto.Id, tenancyId); if (!result.Success) { return(Result.ReFailure(result.Message, result.Status)); } // 除总超级管理员之外其他不允许操作其他租户信息 if (tenancyId != null && result.Data.TenancyId != tenancyId) { return(Result.ReFailure(ResultCodes.TenancyMatchExist)); } result.Data.Enable = dto.Status; return(await server.Modify(result.Data)); }