Merge branch 'master' into dev
# Conflicts: # Bootstrap.Admin/Startup.cs
This commit is contained in:
commit
e90973b983
|
@ -1,37 +1,37 @@
|
|||
using Bootstrap.DataAccess;
|
||||
using System.IO;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace Bootstrap.Admin.Models
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class HeaderBarModel : ModelBase
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="identity"></param>
|
||||
public HeaderBarModel(IIdentity identity)
|
||||
{
|
||||
var user = UserHelper.RetrieveUserByUserName(identity.Name);
|
||||
Icon = Path.Combine(DictHelper.RetrieveIconFolderPath(), string.IsNullOrEmpty(user.Icon) ? DictHelper.RetrieveDefaultIcon() : user.Icon);
|
||||
DisplayName = user.DisplayName;
|
||||
UserName = user.UserName;
|
||||
if (!string.IsNullOrEmpty(user.Css)) Theme = user.Css;
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string UserName { get; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string DisplayName { get; }
|
||||
/// <summary>
|
||||
/// 获得/设置 用户头像地址
|
||||
/// </summary>
|
||||
public string Icon { get; }
|
||||
}
|
||||
using Bootstrap.DataAccess;
|
||||
using System.IO;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace Bootstrap.Admin.Models
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class HeaderBarModel : ModelBase
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="identity"></param>
|
||||
public HeaderBarModel(IIdentity identity)
|
||||
{
|
||||
var user = UserHelper.RetrieveUserByUserName(identity.Name);
|
||||
Icon = Path.Combine(DictHelper.RetrieveIconFolderPath(), string.IsNullOrEmpty(user.Icon) ? DictHelper.RetrieveDefaultIcon() : user.Icon);
|
||||
DisplayName = user.DisplayName;
|
||||
UserName = user.UserName;
|
||||
if (!string.IsNullOrEmpty(user.Css)) Theme = user.Css;
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string UserName { get; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string DisplayName { get; }
|
||||
/// <summary>
|
||||
/// 获得/设置 用户头像地址
|
||||
/// </summary>
|
||||
public string Icon { get; }
|
||||
}
|
||||
}
|
|
@ -1,32 +1,32 @@
|
|||
using Bootstrap.DataAccess;
|
||||
|
||||
namespace Bootstrap.Admin.Models
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class ModelBase
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public ModelBase()
|
||||
{
|
||||
Title = DictHelper.RetrieveWebTitle();
|
||||
Footer = DictHelper.RetrieveWebFooter();
|
||||
Theme = DictHelper.RetrieveActiveTheme();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Title { get; private set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Footer { get; private set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Theme { get; protected set; }
|
||||
}
|
||||
using Bootstrap.DataAccess;
|
||||
|
||||
namespace Bootstrap.Admin.Models
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class ModelBase
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public ModelBase()
|
||||
{
|
||||
Title = DictHelper.RetrieveWebTitle();
|
||||
Footer = DictHelper.RetrieveWebFooter();
|
||||
Theme = DictHelper.RetrieveActiveTheme();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Title { get; private set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Footer { get; private set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Theme { get; protected set; }
|
||||
}
|
||||
}
|
|
@ -1,28 +1,28 @@
|
|||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:50852/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"DOTNET_USE_POLLING_FILE_WATCHER": "true",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"Bootstrap.Admin": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:50852/"
|
||||
}
|
||||
}
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:50852/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"DOTNET_USE_POLLING_FILE_WATCHER": "true",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"Bootstrap.Admin": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:50852/"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,89 +1,89 @@
|
|||
using Longbow.Cache;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Bootstrap.DataAccess
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class CacheCleanUtility
|
||||
{
|
||||
private const string RetrieveAllRolesDataKey = "BootstrapAdminRoleMiddleware-RetrieveRoles";
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="roleIds"></param>
|
||||
/// <param name="userIds"></param>
|
||||
/// <param name="groupIds"></param>
|
||||
/// <param name="menuIds"></param>
|
||||
/// <param name="dictIds"></param>
|
||||
/// <param name="cacheKey"></param>
|
||||
public static void ClearCache(IEnumerable<string> roleIds = null, IEnumerable<string> userIds = null, IEnumerable<string> groupIds = null, IEnumerable<string> menuIds = null, IEnumerable<string> dictIds = null, string cacheKey = null)
|
||||
{
|
||||
var cacheKeys = new List<string>();
|
||||
var corsKeys = new List<string>();
|
||||
if (roleIds != null)
|
||||
{
|
||||
roleIds.ToList().ForEach(id =>
|
||||
{
|
||||
cacheKeys.Add(string.Format("{0}-{1}", UserHelper.RetrieveUsersByRoleIdDataKey, id));
|
||||
cacheKeys.Add(string.Format("{0}-{1}", GroupHelper.RetrieveGroupsByRoleIdDataKey, id));
|
||||
cacheKeys.Add(string.Format("{0}-{1}", MenuHelper.RetrieveMenusByRoleIdDataKey, id));
|
||||
});
|
||||
cacheKeys.Add(RoleHelper.RetrieveRolesDataKey + "*");
|
||||
cacheKeys.Add(MenuHelper.RetrieveMenusAll + "*");
|
||||
cacheKeys.Add(RetrieveAllRolesDataKey + "*");
|
||||
corsKeys.Add(MenuHelper.RetrieveMenusAll + "*");
|
||||
}
|
||||
if (userIds != null)
|
||||
{
|
||||
userIds.ToList().ForEach(id =>
|
||||
{
|
||||
cacheKeys.Add(string.Format("{0}-{1}", RoleHelper.RetrieveRolesByUserIdDataKey, id));
|
||||
cacheKeys.Add(string.Format("{0}-{1}", GroupHelper.RetrieveGroupsByUserIdDataKey, id));
|
||||
cacheKeys.Add(MenuHelper.RetrieveMenusAll + "*");
|
||||
corsKeys.Add(MenuHelper.RetrieveMenusAll + "*");
|
||||
});
|
||||
cacheKeys.Add(UserHelper.RetrieveNewUsersDataKey + "*");
|
||||
cacheKeys.Add(UserHelper.RetrieveUsersDataKey + "*");
|
||||
corsKeys.Add(UserHelper.RetrieveUsersDataKey + "*");
|
||||
}
|
||||
if (groupIds != null)
|
||||
{
|
||||
groupIds.ToList().ForEach(id =>
|
||||
{
|
||||
cacheKeys.Add(string.Format("{0}-{1}", RoleHelper.RetrieveRolesByGroupIdDataKey, id));
|
||||
cacheKeys.Add(string.Format("{0}-{1}", UserHelper.RetrieveUsersByGroupIdDataKey, id));
|
||||
});
|
||||
cacheKeys.Add(GroupHelper.RetrieveGroupsDataKey + "*");
|
||||
cacheKeys.Add(MenuHelper.RetrieveMenusAll + "*");
|
||||
corsKeys.Add(MenuHelper.RetrieveMenusAll + "*");
|
||||
cacheKeys.Add(RetrieveAllRolesDataKey + "*");
|
||||
}
|
||||
if (menuIds != null)
|
||||
{
|
||||
menuIds.ToList().ForEach(id =>
|
||||
{
|
||||
cacheKeys.Add(string.Format("{0}-{1}", RoleHelper.RetrieveRolesByMenuIdDataKey, id));
|
||||
});
|
||||
cacheKeys.Add(MenuHelper.RetrieveMenusByRoleIdDataKey + "*");
|
||||
cacheKeys.Add(MenuHelper.RetrieveMenusAll + "*");
|
||||
corsKeys.Add(MenuHelper.RetrieveMenusAll + "*");
|
||||
}
|
||||
if (dictIds != null)
|
||||
{
|
||||
cacheKeys.Add(DictHelper.RetrieveDictsDataKey + "*");
|
||||
cacheKeys.Add(DictHelper.RetrieveCategoryDataKey);
|
||||
corsKeys.Add(DictHelper.RetrieveDictsDataKey + "*");
|
||||
}
|
||||
if (cacheKey != null)
|
||||
{
|
||||
cacheKeys.Add(cacheKey);
|
||||
corsKeys.Add(cacheKey);
|
||||
}
|
||||
CacheManager.Clear(cacheKeys);
|
||||
CacheManager.CorsClear(corsKeys);
|
||||
}
|
||||
}
|
||||
}
|
||||
using Longbow.Cache;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Bootstrap.DataAccess
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class CacheCleanUtility
|
||||
{
|
||||
private const string RetrieveAllRolesDataKey = "BootstrapAdminRoleMiddleware-RetrieveRoles";
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="roleIds"></param>
|
||||
/// <param name="userIds"></param>
|
||||
/// <param name="groupIds"></param>
|
||||
/// <param name="menuIds"></param>
|
||||
/// <param name="dictIds"></param>
|
||||
/// <param name="cacheKey"></param>
|
||||
public static void ClearCache(IEnumerable<string> roleIds = null, IEnumerable<string> userIds = null, IEnumerable<string> groupIds = null, IEnumerable<string> menuIds = null, IEnumerable<string> dictIds = null, string cacheKey = null)
|
||||
{
|
||||
var cacheKeys = new List<string>();
|
||||
var corsKeys = new List<string>();
|
||||
if (roleIds != null)
|
||||
{
|
||||
roleIds.ToList().ForEach(id =>
|
||||
{
|
||||
cacheKeys.Add(string.Format("{0}-{1}", UserHelper.RetrieveUsersByRoleIdDataKey, id));
|
||||
cacheKeys.Add(string.Format("{0}-{1}", GroupHelper.RetrieveGroupsByRoleIdDataKey, id));
|
||||
cacheKeys.Add(string.Format("{0}-{1}", MenuHelper.RetrieveMenusByRoleIdDataKey, id));
|
||||
});
|
||||
cacheKeys.Add(RoleHelper.RetrieveRolesDataKey + "*");
|
||||
cacheKeys.Add(MenuHelper.RetrieveMenusAll + "*");
|
||||
cacheKeys.Add(RetrieveAllRolesDataKey + "*");
|
||||
corsKeys.Add(MenuHelper.RetrieveMenusAll + "*");
|
||||
}
|
||||
if (userIds != null)
|
||||
{
|
||||
userIds.ToList().ForEach(id =>
|
||||
{
|
||||
cacheKeys.Add(string.Format("{0}-{1}", RoleHelper.RetrieveRolesByUserIdDataKey, id));
|
||||
cacheKeys.Add(string.Format("{0}-{1}", GroupHelper.RetrieveGroupsByUserIdDataKey, id));
|
||||
cacheKeys.Add(MenuHelper.RetrieveMenusAll + "*");
|
||||
corsKeys.Add(MenuHelper.RetrieveMenusAll + "*");
|
||||
});
|
||||
cacheKeys.Add(UserHelper.RetrieveNewUsersDataKey + "*");
|
||||
cacheKeys.Add(UserHelper.RetrieveUsersDataKey + "*");
|
||||
corsKeys.Add(UserHelper.RetrieveUsersDataKey + "*");
|
||||
}
|
||||
if (groupIds != null)
|
||||
{
|
||||
groupIds.ToList().ForEach(id =>
|
||||
{
|
||||
cacheKeys.Add(string.Format("{0}-{1}", RoleHelper.RetrieveRolesByGroupIdDataKey, id));
|
||||
cacheKeys.Add(string.Format("{0}-{1}", UserHelper.RetrieveUsersByGroupIdDataKey, id));
|
||||
});
|
||||
cacheKeys.Add(GroupHelper.RetrieveGroupsDataKey + "*");
|
||||
cacheKeys.Add(MenuHelper.RetrieveMenusAll + "*");
|
||||
corsKeys.Add(MenuHelper.RetrieveMenusAll + "*");
|
||||
cacheKeys.Add(RetrieveAllRolesDataKey + "*");
|
||||
}
|
||||
if (menuIds != null)
|
||||
{
|
||||
menuIds.ToList().ForEach(id =>
|
||||
{
|
||||
cacheKeys.Add(string.Format("{0}-{1}", RoleHelper.RetrieveRolesByMenuIdDataKey, id));
|
||||
});
|
||||
cacheKeys.Add(MenuHelper.RetrieveMenusByRoleIdDataKey + "*");
|
||||
cacheKeys.Add(MenuHelper.RetrieveMenusAll + "*");
|
||||
corsKeys.Add(MenuHelper.RetrieveMenusAll + "*");
|
||||
}
|
||||
if (dictIds != null)
|
||||
{
|
||||
cacheKeys.Add(DictHelper.RetrieveDictsDataKey + "*");
|
||||
cacheKeys.Add(DictHelper.RetrieveCategoryDataKey);
|
||||
corsKeys.Add(DictHelper.RetrieveDictsDataKey + "*");
|
||||
}
|
||||
if (cacheKey != null)
|
||||
{
|
||||
cacheKeys.Add(cacheKey);
|
||||
corsKeys.Add(cacheKey);
|
||||
}
|
||||
CacheManager.Clear(cacheKeys);
|
||||
CacheManager.CorsClear(corsKeys);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue