4.1.2021.1109

This commit is contained in:
大石头 2021-11-09 16:04:01 +08:00
parent 0317a95d87
commit 1dbb835f2e
26 changed files with 165 additions and 44 deletions

View File

@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<AssemblyName>cube</AssemblyName>
<RootNamespace>CubeDemo</RootNamespace>
<AssemblyTitle>魔方演示平台</AssemblyTitle>
<Version>4.0.2021.1109</Version>
<FileVersion>4.0.2021.1109</FileVersion>
<AssemblyVersion>4.0.*</AssemblyVersion>
<Version>4.1.2021.1109</Version>
<FileVersion>4.1.2021.1109</FileVersion>
<AssemblyVersion>4.1.*</AssemblyVersion>
<Deterministic>false</Deterministic>
<OutputPath>..\Bin</OutputPath>
<UserSecretsId>1396351c-62fe-4836-9e51-9d77859955ad</UserSecretsId>

View File

@ -7,9 +7,9 @@
<Description>魔方是一个快速Web开发平台能够快速搭建系统原型而又具有足够灵活的可扩展性内部集成了用户权限管理、模板继承、SSO登录、OAuth服务端、数据导出与分享等多个功能模块默认模板在真实项目中经历过单表100亿数据添删改查的考验。</Description>
<Company>新生命开发团队</Company>
<Copyright>©2002-2021 NewLife</Copyright>
<Version>4.0.2021.1109</Version>
<FileVersion>4.0.2021.1109</FileVersion>
<AssemblyVersion>4.0.*</AssemblyVersion>
<Version>4.1.2021.1109</Version>
<FileVersion>4.1.2021.1109</FileVersion>
<AssemblyVersion>4.1.*</AssemblyVersion>
<Deterministic>false</Deterministic>
<OutputPath>..\..\Bin</OutputPath>
<DocumentationFile>$(OutputPath)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
@ -39,7 +39,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0-beta-20204-02">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

@ -7,9 +7,9 @@
<Description>魔方是一个快速Web开发平台能够快速搭建系统原型而又具有足够灵活的可扩展性内部集成了用户权限管理、模板继承、SSO登录、OAuth服务端、数据导出与分享等多个功能模块默认模板在真实项目中经历过单表100亿数据添删改查的考验。</Description>
<Company>新生命开发团队</Company>
<Copyright>©2002-2021 NewLife</Copyright>
<Version>4.0.2021.0725-beta1</Version>
<FileVersion>4.0.2021.0725</FileVersion>
<AssemblyVersion>4.0.*</AssemblyVersion>
<Version>4.1.2021.1109</Version>
<FileVersion>4.1.2021.1109</FileVersion>
<AssemblyVersion>4.1.*</AssemblyVersion>
<Deterministic>false</Deterministic>
<OutputPath>..\..\Bin</OutputPath>
<DocumentationFile>$(OutputPath)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
@ -39,8 +39,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="5.17.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0-beta-20204-02">
<PackageReference Include="BootstrapBlazor" Version="5.18.4" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

@ -7,9 +7,9 @@
<Description>魔方是一个快速Web开发平台能够快速搭建系统原型而又具有足够灵活的可扩展性内部集成了用户权限管理、模板继承、SSO登录、OAuth服务端、数据导出与分享等多个功能模块默认模板在真实项目中经历过单表100亿数据添删改查的考验。</Description>
<Company>新生命开发团队</Company>
<Copyright>©2002-2021 NewLife</Copyright>
<Version>4.0.2021.1109</Version>
<FileVersion>4.0.2021.1109</FileVersion>
<AssemblyVersion>4.0.*</AssemblyVersion>
<Version>4.1.2021.1109</Version>
<FileVersion>4.1.2021.1109</FileVersion>
<AssemblyVersion>4.1.*</AssemblyVersion>
<Deterministic>false</Deterministic>
<OutputPath>..\..\Bin</OutputPath>
<DocumentationFile>$(OutputPath)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
@ -39,7 +39,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0-beta-20204-02">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

@ -7,9 +7,9 @@
<Description>魔方是一个快速Web开发平台能够快速搭建系统原型而又具有足够灵活的可扩展性内部集成了用户权限管理、模板继承、SSO登录、OAuth服务端、数据导出与分享等多个功能模块默认模板在真实项目中经历过单表100亿数据添删改查的考验。</Description>
<Company>新生命开发团队</Company>
<Copyright>©2002-2021 NewLife</Copyright>
<Version>4.0.2021.1109</Version>
<FileVersion>4.0.2021.1109</FileVersion>
<AssemblyVersion>4.0.*</AssemblyVersion>
<Version>4.1.2021.1109</Version>
<FileVersion>4.1.2021.1109</FileVersion>
<AssemblyVersion>4.1.*</AssemblyVersion>
<Deterministic>false</Deterministic>
<OutputPath>..\..\Bin</OutputPath>
<DocumentationFile>$(OutputPath)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
@ -39,7 +39,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0-beta-20204-02">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

@ -7,9 +7,9 @@
<Description>魔方是一个快速Web开发平台能够快速搭建系统原型而又具有足够灵活的可扩展性内部集成了用户权限管理、模板继承、SSO登录、OAuth服务端、数据导出与分享等多个功能模块默认模板在真实项目中经历过单表100亿数据添删改查的考验。</Description>
<Company>新生命开发团队</Company>
<Copyright>©2002-2021 NewLife</Copyright>
<Version>4.0.2021.1109</Version>
<FileVersion>4.0.2021.1109</FileVersion>
<AssemblyVersion>4.0.*</AssemblyVersion>
<Version>4.1.2021.1109</Version>
<FileVersion>4.1.2021.1109</FileVersion>
<AssemblyVersion>4.1.*</AssemblyVersion>
<Deterministic>false</Deterministic>
<OutputPath>..\..\Bin</OutputPath>
<DocumentationFile>$(OutputPath)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
@ -39,7 +39,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0-beta-20204-02">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

@ -134,6 +134,10 @@ namespace NewLife.Cube.Admin.Controllers
return base.ScanActionMenu(menu);
}
/// <summary>
/// 中国地图
/// </summary>
/// <returns></returns>
public ActionResult Map()
{
PageSetting.EnableNavbar = false;

View File

@ -20,7 +20,11 @@ namespace NewLife.Cube.Admin.Controllers
ListFields.RemoveField("TableId");
}
/// <summary>
/// 高级搜索
/// </summary>
/// <param name="p"></param>
/// <returns></returns>
protected override IEnumerable<ModelColumn> Search(Pager p)
{
var tableId = p["tableId"].ToInt(-1);

View File

@ -100,6 +100,11 @@ namespace NewLife.Cube.Admin.Controllers
});
}
/// <summary>
/// 高级搜索
/// </summary>
/// <param name="p"></param>
/// <returns></returns>
protected override IEnumerable<ModelTable> Search(Pager p)
{
Init();

View File

@ -13,6 +13,13 @@ namespace NewLife.Cube.Admin.Controllers
[Area("Admin")]
public class PrincipalAgentController : EntityController<PrincipalAgent>
{
/// <summary>
/// 添加页面初始化数据
/// </summary>
/// <param name="entity"></param>
/// <param name="type"></param>
/// <param name="post"></param>
/// <returns></returns>
protected override Boolean Valid(PrincipalAgent entity, DataObjectMethodType type, Boolean post)
{
if (!post && type == DataObjectMethodType.Insert)

View File

@ -96,6 +96,7 @@ namespace NewLife.Cube.Admin.Controllers
/// 实例化用户控制器
/// </summary>
/// <param name="passwordService"></param>
/// <param name="userService"></param>
public UserController(PasswordService passwordService, UserService userService)
{
_passwordService = passwordService;

View File

@ -42,9 +42,24 @@ namespace NewLife.Cube.Areas.Admin.Models
/// <summary>注册模型</summary>
public class RegisterModel : ICubeModel
{
/// <summary>
/// 电子邮箱
/// </summary>
public String Email { get; set; }
/// <summary>
/// 用户名
/// </summary>
public String Username { get; set; }
/// <summary>
/// 密码
/// </summary>
public String Password { get; set; }
/// <summary>
/// 确认密码
/// </summary>
public String Password2 { get; set; }
}
@ -53,6 +68,9 @@ namespace NewLife.Cube.Areas.Admin.Models
/// </summary>
public class UserInfo
{
/// <summary>
/// 编号
/// </summary>
public Int32 ID { get; set; }
/// <summary>名称。登录用户名</summary>

View File

@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace NewLife.Cube.Common
{
/// <summary>
/// 格式化类型
/// </summary>
public enum FormatType
{
/// <summary>
@ -23,6 +23,9 @@ namespace NewLife.Cube.Common
DefaultCase = 2
}
/// <summary>
/// 格式化助手
/// </summary>
public static class FormatHelper
{
/// <summary>根据小写和驼峰格式化名称</summary>

View File

@ -894,6 +894,11 @@ namespace NewLife.Cube
return logo;
}
/// <summary>
/// 获取用户所拥有的菜单
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
public static IList<MenuTree> GetMenus(this IUser user)
{
if (user == null) user = XCode.Membership.User.FindAll().FirstOrDefault();

View File

@ -804,10 +804,7 @@ namespace NewLife.Cube.Controllers
}
/// <summary>用户验证。借助OAuth密码式验证并返回用户信息</summary>
/// <param name="client_id">应用标识</param>
/// <param name="client_secret">密钥</param>
/// <param name="username">用户名。可以是设备编码等唯一使用者标识</param>
/// <param name="password">密码</param>
/// <param name="model">令牌模型</param>
/// <returns></returns>
[AllowAnonymous]
public virtual ActionResult UserAuth([FromBody] SsoTokenModel model)

View File

@ -153,6 +153,10 @@ namespace NewLife.Cube.Entity
#endregion
#region
/// <summary>
/// 设置错误
/// </summary>
/// <param name="error"></param>
public void SetError(String error)
{
Status = error;

View File

@ -8,17 +8,38 @@ using NewLife.Reflection;
namespace NewLife.Cube.ViewModels
{
/// <summary>
/// 登录配置模型
/// </summary>
public class LoginConfigModel
{
private readonly Setting _set = Setting.Current;
private readonly SysConfig _cubeSet = SysConfig.Current;
/// <summary>
/// 显示名
/// </summary>
public String DisplayName => _cubeSet.DisplayName;
/// <summary>
/// Logo图标
/// </summary>
public String Logo => String.Empty;
/// <summary>
/// 允许登录
/// </summary>
public Boolean AllowLogin => _set.AllowLogin;
/// <summary>
/// 允许注册
/// </summary>
public Boolean AllowRegister => _set.AllowRegister;
//public Boolean AutoRegister => _set.AutoRegister;
/// <summary>
/// 提供者
/// </summary>
public List<OAuthConfigModel> Providers =>
OAuthConfig.FindAllWithCache().Where(w=>w.Enable).Select(s =>
{
@ -28,6 +49,9 @@ namespace NewLife.Cube.ViewModels
}).ToList();
}
/// <summary>
/// OAuth配置模型
/// </summary>
public class OAuthConfigModel
{
/// <summary>

View File

@ -2,12 +2,31 @@
namespace NewLife.Cube.Charts
{
/// <summary>
/// 名值对
/// </summary>
public class NameValue
{
/// <summary>
/// 名称
/// </summary>
public String Name { get; set; }
/// <summary>
/// 数值
/// </summary>
public Object Value { get; set; }
/// <summary>
/// 实例化
/// </summary>
public NameValue() { }
/// <summary>
/// 实例化
/// </summary>
/// <param name="name"></param>
/// <param name="value"></param>
public NameValue(String name, Object value)
{
Name = name;

View File

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using NewLife.Collections;
@ -13,14 +10,31 @@ namespace NewLife.Cube.Common
private readonly IValueProvider _valueProvider;
private readonly NullableDictionary<String, Object> _body;
/// <summary>
/// 实例化
/// </summary>
/// <param name="valueProvider"></param>
/// <param name="body"></param>
/// <exception cref="ArgumentNullException"></exception>
public CubeBodyValueProvider(IValueProvider valueProvider, NullableDictionary<String, Object> body)
{
_valueProvider = valueProvider;
_body = body ?? throw new ArgumentNullException(nameof(body));
}
/// <summary>
/// 是否包含指定前缀
/// </summary>
/// <param name="prefix"></param>
/// <returns></returns>
public Boolean ContainsPrefix(String prefix) => true;
/// <summary>
/// 取值
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
public ValueProviderResult GetValue(String key)
{
if (key == null) throw new ArgumentNullException(nameof(key));

View File

@ -27,7 +27,7 @@ namespace NewLife.Cube.Extensions
/// <summary>实例化</summary>
/// <param name="assembly"></param>
/// <param name="baseNamespace"></param>
public CubeEmbeddedFileProvider(Assembly assembly, String? baseNamespace)
public CubeEmbeddedFileProvider(Assembly assembly, String baseNamespace)
{
if (assembly == null) throw new ArgumentNullException("assembly");

View File

@ -67,6 +67,12 @@ namespace NewLife.Cube.Extensions
/// <remarks>如果类型是Object返回的类型则是<see cref="NullableDictionary{String,Object}"/></remarks>
public static T GetRequestBody<T>(this HttpRequest request) where T : class, new() => GetRequestBody(request, typeof(T)) as T;
/// <summary>
/// 获取请求主体部分
/// </summary>
/// <param name="request"></param>
/// <param name="type"></param>
/// <returns></returns>
public static Object GetRequestBody(this HttpRequest request, Type type)
{
if (!request.IsAjaxRequest()) return null;

View File

@ -12,6 +12,11 @@ namespace Microsoft.Extensions.DependencyInjection
{
private const SameSiteMode Unspecified = (SameSiteMode)(-1);
/// <summary>
/// 配置SameSite
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
public static IServiceCollection ConfigureNonBreakingSameSiteCookies(this IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>

View File

@ -9,11 +9,11 @@
<Description>Web快速开发平台搭建管理后台灵活可扩展内部集成了用户权限管理、模板继承、SSO登录、OAuth服务端、数据导出与分享等多个功能模块在真实项目中经历过单表100亿数据添删改查的考验。</Description>
<Company>新生命开发团队</Company>
<Copyright>©2002-2021 NewLife</Copyright>
<VersionPrefix>4.0</VersionPrefix>
<VersionPrefix>4.1</VersionPrefix>
<VersionSuffix>$([System.DateTime]::Now.ToString(`yyyy.MMdd`))</VersionSuffix>
<Version>$(VersionPrefix).$(VersionSuffix)</Version>
<FileVersion>$(Version)</FileVersion>
<AssemblyVersion>4.0.*</AssemblyVersion>
<AssemblyVersion>4.1.*</AssemblyVersion>
<Deterministic>false</Deterministic>
<OutputPath>..\..\Bin</OutputPath>
<DocumentationFile>$(OutputPath)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
@ -58,12 +58,12 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0-beta-20204-02">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NewLife.Core" Version="8.11.2021.1102-beta4" />
<PackageReference Include="NewLife.XCode" Version="10.3.2021.1102-beta4" />
<PackageReference Include="NewLife.Core" Version="8.11.2021.1109" />
<PackageReference Include="NewLife.XCode" Version="10.3.2021.1109" />
</ItemGroup>
<ItemGroup>

View File

@ -44,6 +44,7 @@ namespace NewLife.Cube.ViewModels
/// <param name="selectedValues"></param>
/// <param name="optionLabel"></param>
/// <param name="autoPostback"></param>
/// <param name="htmlAttributes"></param>
public ListBoxModel(String name, IEnumerable value, Object selectedValues, String optionLabel, Boolean autoPostback, Object htmlAttributes)
{
Name = name;

View File

@ -69,6 +69,10 @@ namespace NewLife.Cube.ViewModels
return getMenuList?.Invoke(src);
}
/// <summary>
/// 已重载。
/// </summary>
/// <returns></returns>
public override String ToString() => Name;
}
}

View File

@ -19,8 +19,8 @@
<Compile Include="..\CubeDemo\Entity\班级.cs" Link="Entity\班级.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NewLife.Core" Version="8.11.2021.1102-beta4" />
<PackageReference Include="NewLife.XCode" Version="10.3.2021.1102-beta4" />
<PackageReference Include="NewLife.Core" Version="8.11.2021.1109" />
<PackageReference Include="NewLife.XCode" Version="10.3.2021.1109" />
</ItemGroup>
<ItemGroup>
<Folder Include="Entity\" />