chore: 更新依赖到最新版
This commit is contained in:
parent
234063b3bd
commit
312f771313
|
@ -9,12 +9,12 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BootstrapBlazor" Version="6.2.9-beta07" />
|
||||
<PackageReference Include="Exceptionless.AspNetCore" Version="4.6.2" />
|
||||
<PackageReference Include="Longbow.Logging" Version="5.2.0" />
|
||||
<PackageReference Include="BootstrapBlazor" Version="6.8.13" />
|
||||
<PackageReference Include="Exceptionless.AspNetCore" Version="4.8.0" />
|
||||
<PackageReference Include="Longbow.Logging" Version="6.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.0.0" />
|
||||
<PackageReference Include="Sentry.AspNetCore" Version="3.10.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
<PackageReference Include="Sentry.AspNetCore" Version="3.19.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -23,7 +23,8 @@ namespace Microsoft.Extensions.DependencyInjection
|
|||
/// <param name="services"></param>
|
||||
public static IServiceCollection AddBootstrapAdminBackgroundTask(this IServiceCollection services)
|
||||
{
|
||||
services.AddTaskServices(builder => builder.AddFileStorage());
|
||||
//services.AddTaskServices(builder => builder.AddFileStorage());
|
||||
services.AddTaskServices();
|
||||
services.AddHostedService<BootstrapAdminBackgroundServices>();
|
||||
return services;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Bootstrap.Security" Version="5.2.0" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="2.13.2" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="2.17.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -2,23 +2,23 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Bootstrap.Security.DataAccess" Version="5.2.0" />
|
||||
<PackageReference Include="Bootstrap.Security.Mvc" Version="5.2.0" />
|
||||
<PackageReference Include="Bootstrap.Security.Mvc" Version="6.0.0" />
|
||||
<PackageReference Include="Longbow" Version="5.2.0" />
|
||||
<PackageReference Include="Longbow.AlipayAuth" Version="5.2.0" />
|
||||
<PackageReference Include="Longbow.Cache" Version="5.2.0" />
|
||||
<PackageReference Include="Longbow.ComponentModel" Version="5.2.0" />
|
||||
<PackageReference Include="Longbow.ComponentModel" Version="6.0.0" />
|
||||
<PackageReference Include="Longbow.Data" Version="5.2.0" />
|
||||
<PackageReference Include="Longbow.GiteeAuth" Version="5.2.0" />
|
||||
<PackageReference Include="Longbow.GitHubAuth" Version="5.2.0" />
|
||||
<PackageReference Include="Longbow.OAuth" Version="5.2.0" />
|
||||
<PackageReference Include="Longbow.PetaPoco" Version="5.0.1" />
|
||||
<PackageReference Include="Longbow.Security.Cryptography" Version="5.2.0" />
|
||||
<PackageReference Include="Longbow.Tasks" Version="5.1.0" />
|
||||
<PackageReference Include="Longbow.Security.Cryptography" Version="6.0.0" />
|
||||
<PackageReference Include="Longbow.Tasks" Version="5.2.1" />
|
||||
<PackageReference Include="Longbow.TencentAuth" Version="5.2.0" />
|
||||
<PackageReference Include="Longbow.Web" Version="5.2.1" />
|
||||
<PackageReference Include="Longbow.WeChatAuth" Version="5.2.0" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="5.0.11" />
|
||||
<PackageReference Include="PetaPoco.Extensions" Version="5.2.0" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.7" />
|
||||
<PackageReference Include="PetaPoco.Extensions" Version="6.0.0" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
using Longbow.Cache;
|
||||
using Longbow.Web.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PetaPoco;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -25,13 +26,21 @@ namespace Bootstrap.DataAccess
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="provider"></param>
|
||||
/// <param name="eventId"></param>
|
||||
/// <param name="ex"></param>
|
||||
/// <param name="additionalInfo"></param>
|
||||
/// <returns></returns>
|
||||
public static void Log(Exception ex, NameValueCollection additionalInfo)
|
||||
public static void Log(IServiceProvider provider, EventId eventId, Exception? ex, NameValueCollection additionalInfo)
|
||||
{
|
||||
var ret = DbContextManager.Create<Exceptions>()?.Log(ex, additionalInfo) ?? false;
|
||||
if (ret) CacheManager.Clear(RetrieveExceptionsDataKey);
|
||||
if (ex != null)
|
||||
{
|
||||
var ret = DbContextManager.Create<Exceptions>()?.Log(ex, additionalInfo) ?? false;
|
||||
if (ret)
|
||||
{
|
||||
CacheManager.Clear(RetrieveExceptionsDataKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -35,30 +35,40 @@ namespace Bootstrap.DataAccess
|
|||
/// <returns></returns>
|
||||
public static bool Save(BootstrapMenu p)
|
||||
{
|
||||
// 不允许保存系统菜单与前台演示系统的默认菜单
|
||||
var ret = false;
|
||||
|
||||
if (DictHelper.RetrieveSystemModel())
|
||||
{
|
||||
if (p.Category == "0") return true;
|
||||
|
||||
// 查找原有数据比对是否为系统菜单与演示菜单
|
||||
if (!string.IsNullOrEmpty(p.Id))
|
||||
// 不允许保存系统菜单与前台演示系统的默认菜单
|
||||
if (p.Category == "0")
|
||||
{
|
||||
|
||||
// 系统菜单
|
||||
ret = true;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(p.Id))
|
||||
{
|
||||
// 查找原有数据比对是否为系统菜单与演示菜单
|
||||
var menus = RetrieveAllMenus("Admin");
|
||||
#pragma warning disable CS8602 // 取消引用可能出现的空引用。
|
||||
var menu = menus.FirstOrDefault(m => m.Id.Equals(p.Id, System.StringComparison.OrdinalIgnoreCase));
|
||||
#pragma warning restore CS8602 // 取消引用可能出现的空引用。
|
||||
if (menu != null && menu.Category == "0") return true;
|
||||
|
||||
// 演示系统
|
||||
var appMenus = BootstrapAppContext.Configuration.GetSection("AppMenus").Get<ICollection<string>>();
|
||||
if (appMenus.Any(m => m.Equals(menu?.Name, StringComparison.OrdinalIgnoreCase))) return true;
|
||||
var menu = menus.FirstOrDefault(m => m.Id?.Equals(p.Id, System.StringComparison.OrdinalIgnoreCase) ?? false);
|
||||
if (menu != null && menu.Category == "0")
|
||||
{
|
||||
// 系统菜单
|
||||
ret = true;
|
||||
}
|
||||
else if (BootstrapAppContext.Configuration != null)
|
||||
{
|
||||
var appMenus = BootstrapAppContext.Configuration.GetSection("AppMenus").Get<ICollection<string>>();
|
||||
if (appMenus.Any(m => m.Equals(menu?.Name, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var ret = DbContextManager.Create<Menu>()?.Save(p) ?? false;
|
||||
if (ret) CacheCleanUtility.ClearCache(menuIds: string.IsNullOrEmpty(p.Id) ? new List<string>() : new List<string>() { p.Id });
|
||||
else
|
||||
{
|
||||
ret = DbContextManager.Create<Menu>()?.Save(p) ?? false;
|
||||
if (ret) CacheCleanUtility.ClearCache(menuIds: string.IsNullOrEmpty(p.Id) ? new List<string>() : new List<string>() { p.Id });
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -69,23 +79,38 @@ namespace Bootstrap.DataAccess
|
|||
/// <returns></returns>
|
||||
public static bool Delete(IEnumerable<string> value)
|
||||
{
|
||||
var ret = false;
|
||||
if (DictHelper.RetrieveSystemModel())
|
||||
{
|
||||
// 不允许删除系统菜单与前台演示系统的默认菜单
|
||||
var systemMenus = RetrieveAllMenus("Admin").Where(m => m.Category == "0");
|
||||
value = value.Where(v => !systemMenus.Any(m => m.Id == v));
|
||||
if (!value.Any()) return true;
|
||||
|
||||
// 演示系统
|
||||
var appMenus = BootstrapAppContext.Configuration.GetSection("AppMenus").Get<ICollection<string>>();
|
||||
var appIds = RetrieveAllMenus("Admin").Where(m => appMenus.Any(app => m.Name.Equals(app, System.StringComparison.OrdinalIgnoreCase))).Select(m => m.Id);
|
||||
#pragma warning disable CS8602 // 取消引用可能出现的空引用。
|
||||
value = value.Where(m => !appIds.Any(app => app.Equals(m, StringComparison.OrdinalIgnoreCase)));
|
||||
#pragma warning restore CS8602 // 取消引用可能出现的空引用。
|
||||
if (!value.Any()) return true;
|
||||
if (!value.Any())
|
||||
{
|
||||
ret = true;
|
||||
}
|
||||
else if (BootstrapAppContext.Configuration != null)
|
||||
{
|
||||
// 演示系统
|
||||
var appMenus = BootstrapAppContext.Configuration.GetSection("AppMenus").Get<ICollection<string>>();
|
||||
var appIds = RetrieveAllMenus("Admin")
|
||||
.Where(m => appMenus.Any(app => m.Name.Equals(app, System.StringComparison.OrdinalIgnoreCase)))
|
||||
.Select(m => m.Id);
|
||||
value = value.Where(m => !appIds.Any(app => app?.Equals(m, StringComparison.OrdinalIgnoreCase) ?? false));
|
||||
if (!value.Any())
|
||||
{
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = DbContextManager.Create<Menu>()?.Delete(value) ?? false;
|
||||
if (ret)
|
||||
{
|
||||
CacheCleanUtility.ClearCache(menuIds: value);
|
||||
}
|
||||
}
|
||||
var ret = DbContextManager.Create<Menu>()?.Delete(value) ?? false;
|
||||
if (ret) CacheCleanUtility.ClearCache(menuIds: value);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -101,7 +126,7 @@ namespace Bootstrap.DataAccess
|
|||
/// </summary>
|
||||
/// <param name="roleId"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<string> RetrieveMenusByRoleId(string roleId) => CacheManager.GetOrAdd($"{RetrieveMenusByRoleIdDataKey}-{roleId}", k => DbContextManager.Create<Menu>()?.RetrieveMenusByRoleId(roleId), RetrieveMenusByRoleIdDataKey) ?? new string[0];
|
||||
public static IEnumerable<string> RetrieveMenusByRoleId(string roleId) => CacheManager.GetOrAdd($"{RetrieveMenusByRoleIdDataKey}-{roleId}", k => DbContextManager.Create<Menu>()?.RetrieveMenusByRoleId(roleId), RetrieveMenusByRoleIdDataKey) ?? Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// 保存指定角色的所有菜单
|
||||
|
@ -125,7 +150,7 @@ namespace Bootstrap.DataAccess
|
|||
/// <returns></returns>
|
||||
public static IEnumerable<BootstrapMenu> RetrieveAppMenus(string? appId, string? userName, string? activeUrl)
|
||||
{
|
||||
if (string.IsNullOrEmpty(appId) || string.IsNullOrEmpty(userName)) return new BootstrapMenu[0];
|
||||
if (string.IsNullOrEmpty(appId) || string.IsNullOrEmpty(userName)) return Array.Empty<BootstrapMenu>();
|
||||
|
||||
var menus = RetrieveAllMenus(userName).Where(m => m.Category == "1" && m.IsResource == 0);
|
||||
menus = menus.Where(m => m.Application.Equals(appId, StringComparison.OrdinalIgnoreCase));
|
||||
|
@ -162,7 +187,11 @@ namespace Bootstrap.DataAccess
|
|||
/// </summary>
|
||||
/// <param name="userName"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<BootstrapMenu> RetrieveAllMenus(string? userName) => string.IsNullOrEmpty(userName) ? new BootstrapMenu[0] : CacheManager.GetOrAdd($"{RetrieveMenusAll}-{userName}", key => DbContextManager.Create<Menu>()?.RetrieveAllMenus(userName), RetrieveMenusAll) ?? Array.Empty<BootstrapMenu>();
|
||||
public static IEnumerable<BootstrapMenu> RetrieveAllMenus(string? userName) => string.IsNullOrEmpty(userName)
|
||||
? Array.Empty<BootstrapMenu>()
|
||||
: CacheManager.GetOrAdd($"{RetrieveMenusAll}-{userName}", key => DbContextManager.Create<Menu>()
|
||||
?.RetrieveAllMenus(userName), RetrieveMenusAll)
|
||||
?? Array.Empty<BootstrapMenu>();
|
||||
|
||||
/// <summary>
|
||||
/// 通过当前用户名与指定菜单路径获取此菜单下所有授权按钮集合 (userName, url, auths) => bool
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MongoDB.Driver" Version="2.13.2" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="2.17.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Bootstrap.Security.DataAccess" Version="5.2.0" />
|
||||
<PackageReference Include="Bootstrap.Security.Mvc" Version="5.2.0" />
|
||||
<PackageReference Include="Bootstrap.Security.Mvc" Version="6.0.0" />
|
||||
<PackageReference Include="Longbow" Version="5.2.0" />
|
||||
<PackageReference Include="Longbow.Cache" Version="5.2.0" />
|
||||
<PackageReference Include="Longbow.ComponentModel" Version="5.2.0" />
|
||||
<PackageReference Include="Longbow.ComponentModel" Version="6.0.0" />
|
||||
<PackageReference Include="Longbow.Data" Version="5.2.0" />
|
||||
<PackageReference Include="Longbow.Security.Cryptography" Version="5.2.0" />
|
||||
<PackageReference Include="Longbow.Security.Cryptography" Version="6.0.0" />
|
||||
<PackageReference Include="Longbow.Web" Version="5.2.1" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BootstrapBlazor" Version="6.2.7-beta02" />
|
||||
<PackageReference Include="Longbow.Logging" Version="5.2.0" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="5.0.11" />
|
||||
<PackageReference Include="BootstrapBlazor" Version="6.8.13" />
|
||||
<PackageReference Include="Longbow.Logging" Version="6.0.2" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.7" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
Loading…
Reference in New Issue