diff --git a/db/MongoDB/Dicts.js b/db/MongoDB/Dicts.js
index b7e6b1c5..fbcf46e9 100644
--- a/db/MongoDB/Dicts.js
+++ b/db/MongoDB/Dicts.js
@@ -13,8 +13,8 @@
},
{
"Category": "应用程序",
- "Name": "未设置",
- "Code": "0",
+ "Name": "后台管理",
+ "Code": "BA",
"Define": NumberInt(0)
},
{
@@ -140,19 +140,19 @@
{
"Category": "应用程序",
"Name": "测试平台",
- "Code": "2",
+ "Code": "Demo",
"Define": NumberInt(0)
},
{
"Category": "测试平台",
"Name": "网站标题",
- "Code": "托盘组垛程序",
+ "Code": "前台演示系统",
"Define": NumberInt(1)
},
{
"Category": "测试平台",
"Name": "网站页脚",
- "Code": "通用后台管理测试平台",
+ "Code": "前台演示程序后台权限管理框架",
"Define": NumberInt(1)
},
{
@@ -175,7 +175,7 @@
},
{
"Category": "应用首页",
- "Name": "2",
+ "Name": "Demo",
"Code": "http://localhost:49185/",
"Define": NumberInt(0)
},
diff --git a/db/MongoDB/Navigations.js b/db/MongoDB/Navigations.js
index e23ab85a..d7667129 100644
--- a/db/MongoDB/Navigations.js
+++ b/db/MongoDB/Navigations.js
@@ -9,7 +9,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b91"),
@@ -21,7 +21,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4a01"),
@@ -33,7 +33,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4a02"),
@@ -45,7 +45,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4a03"),
@@ -57,7 +57,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4a04"),
@@ -69,7 +69,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4a05"),
@@ -81,7 +81,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4a06"),
@@ -93,7 +93,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("4bd7b8445fa31256f77e4a01"),
@@ -105,7 +105,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b92"),
@@ -117,7 +117,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b93"),
@@ -129,7 +129,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b01"),
@@ -141,7 +141,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b02"),
@@ -153,7 +153,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b03"),
@@ -165,7 +165,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b04"),
@@ -177,7 +177,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b05"),
@@ -189,7 +189,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b06"),
@@ -201,7 +201,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b07"),
@@ -213,7 +213,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b94"),
@@ -225,7 +225,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b10"),
@@ -237,7 +237,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b11"),
@@ -249,7 +249,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b12"),
@@ -261,7 +261,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b13"),
@@ -273,7 +273,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b14"),
@@ -285,7 +285,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(1),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b95"),
@@ -297,7 +297,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b20"),
@@ -309,7 +309,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b21"),
@@ -321,7 +321,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b22"),
@@ -333,7 +333,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b23"),
@@ -345,7 +345,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b24"),
@@ -357,7 +357,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b96"),
@@ -369,7 +369,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b30"),
@@ -381,7 +381,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b31"),
@@ -393,7 +393,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b32"),
@@ -405,7 +405,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b33"),
@@ -417,7 +417,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b34"),
@@ -429,7 +429,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b35"),
@@ -441,7 +441,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b36"),
@@ -453,7 +453,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b97"),
@@ -465,7 +465,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b40"),
@@ -477,7 +477,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b41"),
@@ -489,7 +489,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b42"),
@@ -501,7 +501,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b43"),
@@ -513,7 +513,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b44"),
@@ -525,7 +525,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b98"),
@@ -537,7 +537,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b50"),
@@ -549,7 +549,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b51"),
@@ -561,7 +561,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b52"),
@@ -573,7 +573,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b99"),
@@ -585,7 +585,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b9a"),
@@ -597,7 +597,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b9b"),
@@ -609,7 +609,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b9c"),
@@ -621,7 +621,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd9b3d868aa001661776f57"),
@@ -633,7 +633,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd9b3d868aa001661776f58"),
@@ -645,7 +645,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd9b3d868aa001661776f59"),
@@ -657,7 +657,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd9b3d868aa001661776f60"),
@@ -669,7 +669,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b89"),
@@ -681,7 +681,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5cd7b8445fa31256f77e4b90"),
@@ -693,7 +693,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b9d"),
@@ -705,7 +705,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b59"),
@@ -717,7 +717,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b60"),
@@ -729,7 +729,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b9e"),
@@ -741,7 +741,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b9f"),
@@ -753,7 +753,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4ba0"),
@@ -765,7 +765,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4ba1"),
@@ -777,7 +777,7 @@
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "0"
+ "Application": "BA"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4ba2"),
@@ -789,7 +789,7 @@
"Category": "1",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "2"
+ "Application": "Demo"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4ba4"),
@@ -801,7 +801,7 @@
"Category": "1",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "2"
+ "Application": "Demo"
},
{
"_id": ObjectId("5bd9b3d868aa001661776f56"),
@@ -813,6 +813,6 @@
"Category": "1",
"Target": "_self",
"IsResource": NumberInt(0),
- "Application": "2"
+ "Application": "Demo"
}
];
\ No newline at end of file
diff --git a/db/MySQL/initData.sql b/db/MySQL/initData.sql
index 90ecf59f..7ddedd6b 100644
--- a/db/MySQL/initData.sql
+++ b/db/MySQL/initData.sql
@@ -2,12 +2,12 @@
-- User/123789
DELETE From Users where UserName in ('Admin', 'User');
INSERT INTO Users (UserName, Password, PassSalt, DisplayName, RegisterTime, ApprovedTime, ApprovedBy, Description) values ('Admin', 'Es7WVgNsJuELwWK8daCqufUBknCsSC0IYDphQZAiGOo=', 'W5vpBEOYRGHkQXatN0t+ECM/U8cHDuEgrq56+zZBk4J481xH', 'Administrator', now(), now(), 'system', '系统默认创建');
-INSERT INTO Users (UserName, Password, PassSalt, DisplayName, RegisterTime, ApprovedTime, ApprovedBy, Description, App) values ('User', 'tXG/yNffpnm6cThrCH7wf6jN1ic3VHvLoY4OrzKtrZ4=', 'c5cIrRMn8XjB84M/D/X7Lg9uUqQFmYNEdxb/4HWH8OLa4pNZ', '测试账号', now(), now(), 'system', '系统默认创建', '2');
+INSERT INTO Users (UserName, Password, PassSalt, DisplayName, RegisterTime, ApprovedTime, ApprovedBy, Description, App) values ('User', 'tXG/yNffpnm6cThrCH7wf6jN1ic3VHvLoY4OrzKtrZ4=', 'c5cIrRMn8XjB84M/D/X7Lg9uUqQFmYNEdxb/4HWH8OLa4pNZ', '测试账号', now(), now(), 'system', '系统默认创建', 'Demo');
DELETE From Dicts Where Define = 0;
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('菜单', '系统菜单', '0', 0);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('菜单', '外部菜单', '1', 0);
-INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('应用程序', '未设置', '0', 0);
+INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('应用程序', '后台管理', 'BA', 0);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('网站设置', '网站标题', '后台管理系统', 0);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('网站设置', '网站页脚', '2016 © 通用后台管理系统', 0);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统通知', '用户注册', '0', 0);
@@ -147,31 +147,32 @@ INSERT INTO NavigationRole (NavigationID, RoleID) SELECT n.Id, r.Id FROM Navigat
INSERT INTO NavigationRole (NavigationID, RoleID) SELECT n.Id, r.Id FROM Navigations n left join Roles r on 1=1 Where RoleName = 'Default' and ParentId in (select id from Navigations where Name in ('个人中心'));
-- Client Data
-Delete From Dicts Where Category = '应用程序' and Code = 2;
-INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('应用程序', '测试平台', 2, 0);
-INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('应用首页', 2, 'http://localhost:49185/', 0);
+Delete From Dicts Where Category = '应用程序' and Code = 'Demo';
+INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('应用程序', '测试平台', 'Demo', 0);
+Delete From Dicts Where Category = '应用首页' and Name = 'Demo';
+INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('应用首页', 'Demo', 'http://localhost:49185/', 0);
Delete From Dicts Where Category = '测试平台';
-Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '网站标题', 'BA Client', 1);
-Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '网站页脚', '通用后台管理测试平台', 1);
+Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '网站标题', '前台演示系统', 1);
+Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '网站页脚', '前台演示程序后台权限管理框架', 1);
Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '个人中心地址', 'http://localhost:50852/Admin/Profiles', 1);
Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '系统设置地址', 'http://localhost:50852/Admin/Index', 1);
Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '系统通知地址', 'http://localhost:50852/Admin/Notifications', 1);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('测试平台', 'favicon', 'http://localhost:49185/favicon.ico', 1);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('测试平台', '网站图标', 'http://localhost:49185/favicon.png', 1);
-Delete from Navigations where Application = 2;
-INSERT into Navigations (ParentId, Name, `Order`, Icon, Url, Category, Application) VALUES (0, '首页', 10, 'fa fa-fa', '~/Home/Index', '1', 2);
+Delete from Navigations where Application = 'Demo';
+INSERT into Navigations (ParentId, Name, `Order`, Icon, Url, Category, Application) VALUES (0, '首页', 10, 'fa fa-fa', '~/Home/Index', '1', 'Demo');
-INSERT into Navigations (ParentId, Name, `Order`, Icon, Url, Category, Application) VALUES (0, '测试页面', 20, 'fa fa-fa', '#', '1', 2);
-INSERT into Navigations (ParentId, Name, `Order`, Icon, Url, Category, Application) VALUES (@@identity, '关于', 10, 'fa fa-fa', '~/Home/About', '1', 2);
+INSERT into Navigations (ParentId, Name, `Order`, Icon, Url, Category, Application) VALUES (0, '测试页面', 20, 'fa fa-fa', '#', '1', 'Demo');
+INSERT into Navigations (ParentId, Name, `Order`, Icon, Url, Category, Application) VALUES (@@identity, '关于', 10, 'fa fa-fa', '~/Home/About', '1', 'Demo');
-INSERT into Navigations (ParentId, Name, `Order`, Icon, Url, Category, Application) VALUES (0, '返回码云', 20, 'fa fa-fa', 'https://gitee.com/LongbowEnterprise/BootstrapAdmin', '1', 2);
+INSERT into Navigations (ParentId, Name, `Order`, Icon, Url, Category, Application) VALUES (0, '返回码云', 20, 'fa fa-fa', 'https://gitee.com/LongbowEnterprise/BootstrapAdmin', '1', 'Demo');
-- 菜单授权
-INSERT INTO NavigationRole (NavigationId, RoleId) SELECT n.ID, r.ID FROM Navigations n left join Roles r on 1=1 Where r.RoleName = 'Administrators' and Application= 2;
-INSERT INTO NavigationRole (NavigationId, RoleId) SELECT n.ID, r.ID FROM Navigations n left join Roles r on 1=1 Where r.RoleName = 'Default' and Application = 2;
+INSERT INTO NavigationRole (NavigationId, RoleId) SELECT n.ID, r.ID FROM Navigations n left join Roles r on 1=1 Where r.RoleName = 'Administrators' and Application= 'Demo';
+INSERT INTO NavigationRole (NavigationId, RoleId) SELECT n.ID, r.ID FROM Navigations n left join Roles r on 1=1 Where r.RoleName = 'Default' and Application = 'Demo';
-- 角色对应用授权
-DELETE From RoleApp where AppId = '2';
-INSERT INTO RoleApp (AppId, RoleId) SELECT '2', ID From Roles Where RoleName = 'Default';
\ No newline at end of file
+DELETE From RoleApp where AppId = 'Demo';
+INSERT INTO RoleApp (AppId, RoleId) SELECT 'Demo', ID From Roles Where RoleName = 'Default';
diff --git a/db/MySQL/install.sql b/db/MySQL/install.sql
index 119d7143..cb118656 100644
--- a/db/MySQL/install.sql
+++ b/db/MySQL/install.sql
@@ -68,7 +68,7 @@ CREATE TABLE Navigations(
Category VARCHAR (50) DEFAULT 0,
Target VARCHAR (10) DEFAULT '_self',
IsResource INT DEFAULT 0,
- Application VARCHAR (200) DEFAULT 0
+ Application VARCHAR (200) DEFAULT 'BA'
);
CREATE TABLE NavigationRole(
diff --git a/db/Postgresql/initData.sql b/db/Postgresql/initData.sql
index 20fc3958..b8bcd1cc 100644
--- a/db/Postgresql/initData.sql
+++ b/db/Postgresql/initData.sql
@@ -7,7 +7,7 @@ INSERT INTO Users (UserName, Password, PassSalt, DisplayName, RegisterTime, Appr
DELETE From Dicts Where Define = 0;
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('菜单', '系统菜单', '0', 0);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('菜单', '外部菜单', '1', 0);
-INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('应用程序', '未设置', '0', 0);
+INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('应用程序', '未设置', '', 0);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('网站设置', '网站标题', '后台管理系统', 0);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('网站设置', '网站页脚', '2016 © 通用后台管理系统', 0);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统通知', '用户注册', '0', 0);
diff --git a/db/SQLite/InitData.sql b/db/SQLite/InitData.sql
index eb85ad27..8fbe1608 100644
--- a/db/SQLite/InitData.sql
+++ b/db/SQLite/InitData.sql
@@ -2,12 +2,12 @@
-- User/123789
DELETE From Users where UserName in ('Admin', 'User');
INSERT INTO Users (UserName, Password, PassSalt, DisplayName, RegisterTime, ApprovedTime, ApprovedBy, [Description]) values ('Admin', 'Es7WVgNsJuELwWK8daCqufUBknCsSC0IYDphQZAiGOo=', 'W5vpBEOYRGHkQXatN0t+ECM/U8cHDuEgrq56+zZBk4J481xH', 'Administrator', datetime(CURRENT_TIMESTAMP, 'localtime'), datetime(CURRENT_TIMESTAMP, 'localtime'), 'system', '系统默认创建');
-INSERT INTO Users (UserName, Password, PassSalt, DisplayName, RegisterTime, ApprovedTime, ApprovedBy, [Description], [App]) values ('User', 'tXG/yNffpnm6cThrCH7wf6jN1ic3VHvLoY4OrzKtrZ4=', 'c5cIrRMn8XjB84M/D/X7Lg9uUqQFmYNEdxb/4HWH8OLa4pNZ', '测试账号', datetime(CURRENT_TIMESTAMP, 'localtime'), datetime(CURRENT_TIMESTAMP, 'localtime'), 'system', '系统默认创建', '2');
+INSERT INTO Users (UserName, Password, PassSalt, DisplayName, RegisterTime, ApprovedTime, ApprovedBy, [Description], [App]) values ('User', 'tXG/yNffpnm6cThrCH7wf6jN1ic3VHvLoY4OrzKtrZ4=', 'c5cIrRMn8XjB84M/D/X7Lg9uUqQFmYNEdxb/4HWH8OLa4pNZ', '测试账号', datetime(CURRENT_TIMESTAMP, 'localtime'), datetime(CURRENT_TIMESTAMP, 'localtime'), 'system', '系统默认创建', 'Demo');
DELETE From Dicts Where Define = 0;
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('菜单', '系统菜单', '0', 0);
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('菜单', '外部菜单', '1', 0);
-INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('应用程序', '未设置', '0', 0);
+INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('应用程序', '后台管理', 'BA', 0);
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('网站设置', '网站标题', '后台管理系统', 0);
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('网站设置', '网站页脚', '2016 © 通用后台管理系统', 0);
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统通知', '用户注册', '0', 0);
@@ -138,46 +138,46 @@ INSERT INTO [Roles] ([RoleName], [Description]) VALUES ('Administrators', '系
INSERT INTO [Roles] ([RoleName], [Description]) VALUES ('Default', '默认用户,可访问前台页面');
DELETE FROM RoleGroup;
-INSERT INTO RoleGroup (GroupId, RoleId) SELECT g.Id, r.Id From Groups g left join Roles r where GroupName = 'Admin' and RoleName = 'Administrators';
+INSERT INTO RoleGroup (GroupId, RoleId) SELECT g.Id, r.Id From Groups g left join Roles r on 1=1 where GroupName = 'Admin' and RoleName = 'Administrators';
DELETE FROM UserGroup;
DELETE FROM UserRole;
-INSERT INTO UserRole (UserId, RoleId) SELECT u.Id, r.Id From Users u left join Roles r where UserName = 'Admin' and RoleName = 'Administrators';
-INSERT INTO UserRole (UserId, RoleId) SELECT u.Id, r.Id From Users u left join Roles r where UserName = 'User' and RoleName = 'Default';
+INSERT INTO UserRole (UserId, RoleId) SELECT u.Id, r.Id From Users u left join Roles r on 1=1 where UserName = 'Admin' and RoleName = 'Administrators';
+INSERT INTO UserRole (UserId, RoleId) SELECT u.Id, r.Id From Users u left join Roles r on 1=1 where UserName = 'User' and RoleName = 'Default';
DELETE FROM NavigationRole;
-INSERT INTO NavigationRole (NavigationID, RoleID) SELECT n.Id, r.Id FROM Navigations n left join Roles r Where RoleName = 'Administrators';
-INSERT INTO NavigationRole (NavigationID, RoleID) SELECT n.Id, r.Id FROM Navigations n left join Roles r Where RoleName = 'Default' and Name in ('后台管理', '个人中心', '返回前台', '通知管理');
-INSERT INTO NavigationRole (NavigationID, RoleID) SELECT n.Id, r.Id FROM Navigations n left join Roles r Where RoleName = 'Default' and ParentId in (select id from Navigations where Name in ('个人中心'));
+INSERT INTO NavigationRole (NavigationID, RoleID) SELECT n.Id, r.Id FROM Navigations n left join Roles r on 1=1 Where RoleName = 'Administrators';
+INSERT INTO NavigationRole (NavigationID, RoleID) SELECT n.Id, r.Id FROM Navigations n left join Roles r on 1=1 Where RoleName = 'Default' and Name in ('后台管理', '个人中心', '返回前台', '通知管理');
+INSERT INTO NavigationRole (NavigationID, RoleID) SELECT n.Id, r.Id FROM Navigations n left join Roles r on 1=1 Where RoleName = 'Default' and ParentId in (select id from Navigations where Name in ('个人中心'));
-- Client Data
-Delete From [Dicts] Where Category = '应用程序' and Code = 2;
-INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('应用程序', '测试平台', 2, 0);
-Delete From [Dicts] Where Category = '应用首页' and Name = 2;
-INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('应用首页', 2, 'http://localhost:49185/', 0);
+Delete From [Dicts] Where Category = '应用程序' and Code = 'Demo';
+INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('应用程序', '测试平台', 'Demo', 0);
+Delete From [Dicts] Where Category = '应用首页' and Name = 'Demo';
+INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('应用首页', 'Demo', 'http://localhost:49185/', 0);
Delete From [Dicts] Where Category = '测试平台';
Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '网站标题', '前台演示系统', 1);
-Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '网站页脚', '通用后台管理测试平台', 1);
+Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '网站页脚', '前台演示程序后台权限管理框架', 1);
Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '个人中心地址', 'http://localhost:50852/Admin/Profiles', 1);
Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '系统设置地址', 'http://localhost:50852/Admin/Index', 1);
Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '系统通知地址', 'http://localhost:50852/Admin/Notifications', 1);
INSERT INTO Dicts (Category, [Name], Code, Define) VALUES ('测试平台', 'favicon', 'http://localhost:49185/favicon.ico', 1);
INSERT INTO Dicts (Category, [Name], Code, Define) VALUES ('测试平台', '网站图标', 'http://localhost:49185/favicon.png', 1);
-Delete from [Navigations] where Application = 2;
-INSERT into [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (0, '首页', 10, 'fa fa-fa', '~/Home/Index', '1', 2);
+Delete from [Navigations] where Application = 'Demo';
+INSERT into [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (0, '首页', 10, 'fa fa-fa', '~/Home/Index', '1', 'Demo');
-INSERT into [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (0, '测试页面', 20, 'fa fa-fa', '#', '1', 2);
-INSERT into [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (last_insert_rowid(), '关于', 10, 'fa fa-fa', '~/Home/About', '1', 2);
+INSERT into [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (0, '测试页面', 20, 'fa fa-fa', '#', '1', 'Demo');
+INSERT into [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (last_insert_rowid(), '关于', 10, 'fa fa-fa', '~/Home/About', '1', 'Demo');
-INSERT into [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (0, '返回码云', 20, 'fa fa-fa', 'https://gitee.com/LongbowEnterprise/BootstrapAdmin', '1', 2);
+INSERT into [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (0, '返回码云', 20, 'fa fa-fa', 'https://gitee.com/LongbowEnterprise/BootstrapAdmin', '1', 'Demo');
-- 菜单授权
-INSERT INTO NavigationRole (NavigationId, RoleId) SELECT n.ID, r.ID FROM Navigations n left join Roles r Where r.RoleName = 'Administrators' and [Application] = 2;
-INSERT INTO NavigationRole (NavigationId, RoleId) SELECT n.ID, r.ID FROM Navigations n left join Roles r Where r.RoleName = 'Default' and [Application] = 2;
+INSERT INTO NavigationRole (NavigationId, RoleId) SELECT n.ID, r.ID FROM Navigations n left join Roles r on 1=1 Where r.RoleName = 'Administrators' and [Application] = 'Demo';
+INSERT INTO NavigationRole (NavigationId, RoleId) SELECT n.ID, r.ID FROM Navigations n left join Roles r on 1=1 Where r.RoleName = 'Default' and [Application] = 'Demo';
-- 角色对应用授权
-DELETE From RoleApp where AppId = '2';
-INSERT INTO RoleApp (AppId, RoleId) SELECT '2', ID From Roles Where RoleName = 'Default';
\ No newline at end of file
+DELETE From RoleApp where AppId = 'Demo';
+INSERT INTO RoleApp (AppId, RoleId) SELECT 'Demo', ID From Roles Where RoleName = 'Default';
\ No newline at end of file
diff --git a/db/SQLite/Install.sql b/db/SQLite/Install.sql
index 55835a60..335f8cd7 100644
--- a/db/SQLite/Install.sql
+++ b/db/SQLite/Install.sql
@@ -63,12 +63,12 @@ CREATE TABLE Navigations(
ParentId INT DEFAULT (0),
Name VARCHAR (50) NOT NULL,
[Order] INT NOT NULL DEFAULT (0),
- Icon VARCHAR (50) DEFAULT none,
+ Icon VARCHAR (50) DEFAULT (none),
Url VARCHAR (4000) NULL,
Category VARCHAR (50) DEFAULT 0,
- Target VARCHAR (10) DEFAULT _self,
+ Target VARCHAR (10) DEFAULT (_self),
IsResource INT DEFAULT (0),
- Application VARCHAR (200) DEFAULT (0)
+ Application VARCHAR (200) DEFAULT (BA) COLLATE NOCASE
);
CREATE TABLE NavigationRole(
@@ -89,7 +89,7 @@ CREATE TABLE Logs(
RequestUrl VARCHAR (500) NOT NULL,
RequestData TEXT NULL,
UserAgent VARCHAR (2000) NULL,
- Referer VARCHAR (2000)
+ Referer VARCHAR (2000)
);
CREATE TABLE Groups(
diff --git a/db/SqlServer/InitData.sql b/db/SqlServer/InitData.sql
index 9c6ebfa5..6ff1668c 100644
--- a/db/SqlServer/InitData.sql
+++ b/db/SqlServer/InitData.sql
@@ -5,12 +5,12 @@ GO
-- User/123789
DELETE From Users where UserName in ('Admin', 'User')
INSERT INTO Users (UserName, Password, PassSalt, DisplayName, RegisterTime, ApprovedTime, ApprovedBy, [Description]) values ('Admin', 'Es7WVgNsJuELwWK8daCqufUBknCsSC0IYDphQZAiGOo=', 'W5vpBEOYRGHkQXatN0t+ECM/U8cHDuEgrq56+zZBk4J481xH', 'Administrator', GetDate(), GetDate(), 'system', N'系统默认创建')
-INSERT INTO Users (UserName, Password, PassSalt, DisplayName, RegisterTime, ApprovedTime, ApprovedBy, [Description], App) values ('User', 'tXG/yNffpnm6cThrCH7wf6jN1ic3VHvLoY4OrzKtrZ4=', 'c5cIrRMn8XjB84M/D/X7Lg9uUqQFmYNEdxb/4HWH8OLa4pNZ', N'测试账号', GetDate(), GetDate(), 'system', N'系统默认创建', '2')
+INSERT INTO Users (UserName, Password, PassSalt, DisplayName, RegisterTime, ApprovedTime, ApprovedBy, [Description], App) values ('User', 'tXG/yNffpnm6cThrCH7wf6jN1ic3VHvLoY4OrzKtrZ4=', 'c5cIrRMn8XjB84M/D/X7Lg9uUqQFmYNEdxb/4HWH8OLa4pNZ', N'测试账号', GetDate(), GetDate(), 'system', N'系统默认创建', 'Demo')
DELETE From Dicts Where Define = 0
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'菜单', N'系统菜单', N'0', 0)
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'菜单', N'外部菜单', N'1', 0)
-INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'应用程序', N'未设置', N'0', 0)
+INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'应用程序', N'后台管理', N'BA', 0)
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'网站设置', N'网站标题', N'后台管理系统', 0)
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'网站设置', N'网站页脚', N'2016 © 通用后台管理系统', 0)
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统通知', N'用户注册', N'0', 0)
@@ -154,9 +154,9 @@ INSERT INTO NavigationRole (NavigationID, RoleID) SELECT n.Id, r.Id FROM Navigat
INSERT INTO NavigationRole (NavigationID, RoleID) SELECT n.Id, r.Id FROM Navigations n left join Roles r on 1=1 where RoleName = 'Default' and ParentId in (select Id from Navigations where Name in (N'个人中心'))
-- Client Data
-Declare @AppId nvarchar(1)
-set @AppId = N'2'
-declare @AppName nvarchar(8)
+Declare @AppId nvarchar(50)
+set @AppId = N'Demo'
+declare @AppName nvarchar(50)
set @AppName = N'测试平台'
Delete From [dbo].[Dicts] Where Category = N'应用程序' and Code = @AppId
@@ -165,8 +165,8 @@ Delete From [Dicts] Where Category = '应用首页' and Name = @AppId
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'应用首页', @AppId, 'http://localhost:49185/', 0)
Delete From [dbo].[Dicts] Where Category = @AppName
-Insert Dicts (Category, Name, Code, Define) values (@AppName, N'网站标题', N'托盘组垛程序', 1);
-Insert Dicts (Category, Name, Code, Define) values (@AppName, N'网站页脚', N'通用后台管理测试平台', 1);
+Insert Dicts (Category, Name, Code, Define) values (@AppName, N'网站标题', N'前台演示程序', 1);
+Insert Dicts (Category, Name, Code, Define) values (@AppName, N'网站页脚', N'前台演示程序后台权限管理框架', 1);
Insert Dicts (Category, Name, Code, Define) values (@AppName, N'个人中心地址', N'http://localhost:50852/Admin/Profiles', 1);
Insert Dicts (Category, Name, Code, Define) values (@AppName, N'系统设置地址', N'http://localhost:50852/Admin/Index', 1);
Insert Dicts (Category, Name, Code, Define) values (@AppName, N'系统通知地址', N'http://localhost:50852/Admin/Notifications', 1);
diff --git a/db/SqlServer/Install.sql b/db/SqlServer/Install.sql
index 64d0c34f..62115ac8 100644
--- a/db/SqlServer/Install.sql
+++ b/db/SqlServer/Install.sql
@@ -240,7 +240,7 @@ GO
ALTER TABLE [dbo].[Navigations] ADD CONSTRAINT [DF_Navigations_IsResource] DEFAULT ((0)) FOR [IsResource]
GO
-ALTER TABLE [dbo].[Navigations] ADD CONSTRAINT [DF_Navigations_Application] DEFAULT ((0)) FOR [Application]
+ALTER TABLE [dbo].[Navigations] ADD CONSTRAINT [DF_Navigations_Application] DEFAULT (N'BA') FOR [Application]
GO
ALTER TABLE [dbo].[Navigations] ADD CONSTRAINT [DF_Navigations_Target] DEFAULT ('_self') FOR [Target]
diff --git a/src/admin/Bootstrap.Admin/Bootstrap.Admin.csproj b/src/admin/Bootstrap.Admin/Bootstrap.Admin.csproj
index 878e21eb..4e33bb8d 100644
--- a/src/admin/Bootstrap.Admin/Bootstrap.Admin.csproj
+++ b/src/admin/Bootstrap.Admin/Bootstrap.Admin.csproj
@@ -10,12 +10,11 @@
-
+
-
diff --git a/src/admin/Bootstrap.Admin/BootstrapAdmin.db b/src/admin/Bootstrap.Admin/BootstrapAdmin.db
index 01609620..f3d77d23 100644
Binary files a/src/admin/Bootstrap.Admin/BootstrapAdmin.db and b/src/admin/Bootstrap.Admin/BootstrapAdmin.db differ
diff --git a/src/admin/Bootstrap.Admin/Controllers/AccountController.cs b/src/admin/Bootstrap.Admin/Controllers/AccountController.cs
index 4e35fd22..8e2cbb87 100644
--- a/src/admin/Bootstrap.Admin/Controllers/AccountController.cs
+++ b/src/admin/Bootstrap.Admin/Controllers/AccountController.cs
@@ -1,5 +1,6 @@
using Bootstrap.Admin.Models;
using Bootstrap.DataAccess;
+using Bootstrap.Security.Mvc;
using Longbow.GiteeAuth;
using Longbow.GitHubAuth;
using Longbow.WeChatAuth;
@@ -72,7 +73,7 @@ namespace Bootstrap.Admin.Controllers
///
///
[HttpGet]
- public ActionResult Login([FromQuery] string appId = "0")
+ public ActionResult Login([FromQuery]string appId = null)
{
if (DictHelper.RetrieveSystemModel())
{
@@ -137,13 +138,12 @@ namespace Bootstrap.Admin.Controllers
/// User name.
/// Password.
/// Remember.
- ///
[HttpPost]
- public async Task Login(string userName, string password, string remember, string appId = "0")
+ public async Task Login(string userName, string password, string remember)
{
var auth = UserHelper.Authenticate(userName, password);
HttpContext.Log(userName, auth);
- return auth ? await SignInAsync(userName, remember == "true") : View("Login", new LoginModel(appId) { AuthFailed = true });
+ return auth ? await SignInAsync(userName, remember == "true") : View("Login", new LoginModel() { AuthFailed = true });
}
private async Task SignInAsync(string userName, bool persistent, string authenticationScheme = CookieAuthenticationDefaults.AuthenticationScheme)
@@ -163,10 +163,10 @@ namespace Bootstrap.Admin.Controllers
///
/// The logout.
[HttpGet]
- public async Task Logout([FromQuery]string appId = "0")
+ public async Task Logout([FromQuery]string appId)
{
await HttpContext.SignOutAsync();
- return Redirect(QueryHelpers.AddQueryString(Request.PathBase + CookieAuthenticationDefaults.LoginPath, "AppId", appId));
+ return Redirect(QueryHelpers.AddQueryString(Request.PathBase + CookieAuthenticationDefaults.LoginPath, "AppId", appId ?? BootstrapAppContext.AppId));
}
///
diff --git a/src/admin/Bootstrap.Admin/Controllers/Api/InterfaceController.cs b/src/admin/Bootstrap.Admin/Controllers/Api/InterfaceController.cs
index 981c4150..1bc8257b 100644
--- a/src/admin/Bootstrap.Admin/Controllers/Api/InterfaceController.cs
+++ b/src/admin/Bootstrap.Admin/Controllers/Api/InterfaceController.cs
@@ -1,14 +1,16 @@
using Bootstrap.DataAccess;
using Bootstrap.Security;
+using Bootstrap.Security.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Configuration;
using System.Collections.Generic;
using System.Security.Principal;
namespace Bootstrap.Admin.Controllers
{
///
- ///
+ /// 接口控制器
///
[Route("api/[controller]/[action]")]
[AllowAnonymous]
@@ -16,7 +18,7 @@ namespace Bootstrap.Admin.Controllers
public class InterfaceController : ControllerBase
{
///
- ///
+ /// 获取所有字典表数据
///
///
[HttpPost]
@@ -24,17 +26,19 @@ namespace Bootstrap.Admin.Controllers
{
return DictHelper.RetrieveDicts();
}
+
///
- ///
+ /// 通过请求地址获取相对应角色集合
///
///
[HttpPost]
public IEnumerable RetrieveRolesByUrl([FromBody]string url)
{
- return RoleHelper.RetrievesByUrl(url);
+ return RoleHelper.RetrievesByUrl(url, BootstrapAppContext.AppId);
}
+
///
- ///
+ /// 通过用户名获得分配所有角色
///
///
[HttpPost]
@@ -42,8 +46,9 @@ namespace Bootstrap.Admin.Controllers
{
return RoleHelper.RetrievesByUserName(userName);
}
+
///
- ///
+ /// 通过用户名获得 User 实例
///
///
[HttpPost]
@@ -51,9 +56,11 @@ namespace Bootstrap.Admin.Controllers
{
return UserHelper.RetrieveUserByUserName(new GenericIdentity(userName));
}
+
///
- ///
+ /// 通过指定条件获得应用程序菜单
///
+ ///
///
[HttpPost]
public IEnumerable RetrieveAppMenus([FromBody]AppMenuOption args)
diff --git a/src/admin/Bootstrap.Admin/Controllers/Api/MenusController.cs b/src/admin/Bootstrap.Admin/Controllers/Api/MenusController.cs
index 23a592f0..4ff6474a 100644
--- a/src/admin/Bootstrap.Admin/Controllers/Api/MenusController.cs
+++ b/src/admin/Bootstrap.Admin/Controllers/Api/MenusController.cs
@@ -6,7 +6,6 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using System.Collections.Generic;
-using System.Security.Policy;
namespace Bootstrap.Admin.Controllers.Api
{
diff --git a/src/admin/Bootstrap.Admin/Controllers/HomeController.cs b/src/admin/Bootstrap.Admin/Controllers/HomeController.cs
index 48b7d78c..eaf5e393 100644
--- a/src/admin/Bootstrap.Admin/Controllers/HomeController.cs
+++ b/src/admin/Bootstrap.Admin/Controllers/HomeController.cs
@@ -7,25 +7,26 @@ using Microsoft.AspNetCore.Mvc;
namespace Bootstrap.Admin.Controllers
{
///
- ///
+ /// Home Controller
///
[Authorize]
public class HomeController : Controller
{
///
- ///
+ /// Index View
///
///
public IActionResult Index()
{
var model = new HeaderBarModel(User.Identity);
if (string.IsNullOrEmpty(model.UserName)) return Redirect(Request.PathBase + CookieAuthenticationDefaults.LogoutPath);
- var url = DictHelper.RetrieveHomeUrl(model.AppId);
- return url.Equals("~/Home/Index", System.StringComparison.OrdinalIgnoreCase) ? (IActionResult)View(model) : Redirect(url);
+
+ var homeUrl = DictHelper.RetrieveHomeUrl(model.AppId);
+ return homeUrl.Equals("~/Home/Index", System.StringComparison.OrdinalIgnoreCase) ? (IActionResult)View(model) : Redirect(homeUrl);
}
///
- ///
+ /// Error View
///
///
///
diff --git a/src/admin/Bootstrap.Admin/Models/AdminModel.cs b/src/admin/Bootstrap.Admin/Models/AdminModel.cs
index b15f5e87..a5edae1f 100644
--- a/src/admin/Bootstrap.Admin/Models/AdminModel.cs
+++ b/src/admin/Bootstrap.Admin/Models/AdminModel.cs
@@ -1,4 +1,5 @@
using Bootstrap.DataAccess;
+using Bootstrap.Security.Mvc;
namespace Bootstrap.Admin.Models
{
@@ -11,8 +12,10 @@ namespace Bootstrap.Admin.Models
/// 默认构造函数
///
///
- public AdminModel(string appId = "0")
+ public AdminModel(string appId = null)
{
+ if (string.IsNullOrEmpty(appId)) appId = BootstrapAppContext.AppId;
+
Title = DictHelper.RetrieveWebTitle(appId);
Footer = DictHelper.RetrieveWebFooter(appId);
Theme = DictHelper.RetrieveActiveTheme();
diff --git a/src/admin/Bootstrap.Admin/Models/HeaderBarModel.cs b/src/admin/Bootstrap.Admin/Models/HeaderBarModel.cs
index d0306b4f..21c4394f 100644
--- a/src/admin/Bootstrap.Admin/Models/HeaderBarModel.cs
+++ b/src/admin/Bootstrap.Admin/Models/HeaderBarModel.cs
@@ -1,16 +1,17 @@
using Bootstrap.DataAccess;
+using Bootstrap.Security.Mvc;
using System;
using System.Security.Principal;
namespace Bootstrap.Admin.Models
{
///
- ///
+ /// Header Model
///
public class HeaderBarModel : AdminModel
{
///
- ///
+ /// 默认构造函数
///
///
public HeaderBarModel(IIdentity identity)
@@ -25,6 +26,9 @@ namespace Bootstrap.Admin.Models
Css = user.Css;
ActiveCss = string.IsNullOrEmpty(Css) ? Theme : Css;
+ // 当前用户未设置应用程序时 使用当前配置 appId
+ if (AppId.IsNullOrEmpty()) AppId = BootstrapAppContext.AppId;
+
// 通过 AppCode 获取用户默认应用的标题
Title = DictHelper.RetrieveWebTitle(AppId);
Footer = DictHelper.RetrieveWebFooter(AppId);
@@ -32,26 +36,28 @@ namespace Bootstrap.Admin.Models
// feat: https://gitee.com/LongbowEnterprise/dashboard/issues?id=I12VKZ
// 后台系统网站图标跟随个人中心设置的默认应用站点的展示
WebSiteIcon = DictHelper.RetrieveWebIcon(AppId);
+ WebSiteLogo = DictHelper.RetrieveWebLogo(AppId);
+
}
}
///
- ///
+ /// 获得 当前用户登录名
///
public string UserName { get; }
///
- ///
+ /// 获得 当前用户显示名称
///
public string DisplayName { get; }
///
- /// 获得/设置 用户头像地址
+ /// 获得 用户头像地址
///
public string Icon { get; }
///
- /// 获取/设置 个人网站样式
+ /// 获取 个人网站样式
///
public string Css { get; }
diff --git a/src/admin/Bootstrap.Admin/Models/LoginModel.cs b/src/admin/Bootstrap.Admin/Models/LoginModel.cs
index 0bf4bb48..1374f9c8 100644
--- a/src/admin/Bootstrap.Admin/Models/LoginModel.cs
+++ b/src/admin/Bootstrap.Admin/Models/LoginModel.cs
@@ -11,7 +11,7 @@ namespace Bootstrap.Admin.Models
/// 默认构造函数
///
///
- public LoginModel(string appId = "0") : base(appId)
+ public LoginModel(string appId = null) : base(appId)
{
ImageLibUrl = DictHelper.RetrieveImagesLibUrl();
}
diff --git a/src/admin/Bootstrap.Admin/Models/ModelBase.cs b/src/admin/Bootstrap.Admin/Models/ModelBase.cs
index 3e679bec..8f30917b 100644
--- a/src/admin/Bootstrap.Admin/Models/ModelBase.cs
+++ b/src/admin/Bootstrap.Admin/Models/ModelBase.cs
@@ -9,5 +9,10 @@
/// 获取 网站 logo 小图标
///
public string WebSiteIcon { get; protected set; } = "~/favicon.ico";
+
+ ///
+ /// 获得 网站图标
+ ///
+ public string WebSiteLogo { get; protected set; } = "~/favicon.png";
}
}
diff --git a/src/admin/Bootstrap.Admin/Models/NavigatorBarModel.cs b/src/admin/Bootstrap.Admin/Models/NavigatorBarModel.cs
index e795f92a..60fb1537 100644
--- a/src/admin/Bootstrap.Admin/Models/NavigatorBarModel.cs
+++ b/src/admin/Bootstrap.Admin/Models/NavigatorBarModel.cs
@@ -1,4 +1,4 @@
-using Bootstrap.DataAccess;
+using Bootstrap.DataAccess;
using Bootstrap.Security;
using Microsoft.AspNetCore.Mvc;
using System;
@@ -20,18 +20,9 @@ namespace Bootstrap.Admin.Models
{
Navigations = MenuHelper.RetrieveSystemMenus(UserName, $"~{controller.HttpContext.Request.Path}");
var authApps = AppHelper.RetrievesByUserName(controller.User.Identity.Name);
- Applications = DictHelper.RetrieveApps().Where(app => app.Key == "0" || authApps.Any(key => key.Equals(app.Key, StringComparison.OrdinalIgnoreCase)));
-
- // feat: https://gitee.com/LongbowEnterprise/dashboard/issues?id=I12VKZ
- // 后台系统网站图标跟随个人中心设置的默认应用站点的展示
- WebSiteLogo = DictHelper.RetrieveWebLogo(AppId);
+ Applications = DictHelper.RetrieveApps().Where(app => app.Key.IsNullOrEmpty() || authApps.Any(key => key.Equals(app.Key, StringComparison.OrdinalIgnoreCase)));
}
- ///
- /// 获得 网站图标
- ///
- public string WebSiteLogo { get; protected set; }
-
///
/// 获得 网站菜单
///
diff --git a/src/admin/Bootstrap.Admin/Query/QueryMenuOption.cs b/src/admin/Bootstrap.Admin/Query/QueryMenuOption.cs
index de8214c9..03a21ab2 100644
--- a/src/admin/Bootstrap.Admin/Query/QueryMenuOption.cs
+++ b/src/admin/Bootstrap.Admin/Query/QueryMenuOption.cs
@@ -33,7 +33,7 @@ namespace Bootstrap.Admin.Query
///
///
///
- public string AppCode { get; set; }
+ public string AppId { get; set; }
///
///
@@ -59,9 +59,9 @@ namespace Bootstrap.Admin.Query
{
data = data.Where(t => t.IsResource.ToString() == IsResource);
}
- if (!string.IsNullOrEmpty(AppCode))
+ if (!string.IsNullOrEmpty(AppId))
{
- data = data.Where(t => t.Application.Equals(AppCode, StringComparison.OrdinalIgnoreCase));
+ data = data.Where(t => t.Application.Equals(AppId, StringComparison.OrdinalIgnoreCase));
}
var ret = new QueryData
///
///
- public override string RetrieveWebTitle(string appId = "0")
+ public override string RetrieveWebTitle(string appId)
{
var code = RetrieveAppName("网站标题", appId);
if (code == "网站标题未设置") code = DictHelper.RetrieveDicts().FirstOrDefault(d => d.Name == "网站标题" && d.Category == "网站设置" && d.Define == 0)?.Code ?? "后台管理系统";
@@ -90,9 +90,9 @@ namespace Bootstrap.DataAccess.MongoDB
///
///
///
- public override string RetrieveWebFooter(string appId = "0")
+ public override string RetrieveWebFooter(string appId)
{
- var code = RetrieveAppName("网站页脚");
+ var code = RetrieveAppName("网站页脚", appId);
if (code == "网站页脚未设置") code = DictHelper.RetrieveDicts().FirstOrDefault(d => d.Name == "网站页脚" && d.Category == "网站设置" && d.Define == 0)?.Code ?? "2016 © 通用后台管理系统";
return code;
}
diff --git a/src/admin/Bootstrap.DataAccess.MongoDB/Role.cs b/src/admin/Bootstrap.DataAccess.MongoDB/Role.cs
index f7e8b52f..7f63396b 100644
--- a/src/admin/Bootstrap.DataAccess.MongoDB/Role.cs
+++ b/src/admin/Bootstrap.DataAccess.MongoDB/Role.cs
@@ -1,4 +1,5 @@
using MongoDB.Driver;
+using System;
using System.Collections.Generic;
using System.Linq;
@@ -193,11 +194,12 @@ namespace Bootstrap.DataAccess.MongoDB
///
///
///
+ ///
///
- public override IEnumerable RetrievesByUrl(string url)
+ public override IEnumerable RetrievesByUrl(string url, string appId)
{
var menu = DbManager.Menus.Find(md => md.Url.StartsWith(url)).FirstOrDefault();
- var ret = RoleHelper.Retrieves().Cast().Where(md => md.Menus != null && md.Menus.Contains(menu.Id)).Select(m => m.RoleName).ToList();
+ var ret = RoleHelper.Retrieves().Cast().Where(md => md.Menus != null && md.Menus.Any(m => m.Equals(menu.Id, StringComparison.OrdinalIgnoreCase)) && md.Apps.Contains(appId)).Select(m => m.RoleName).ToList();
if (!ret.Contains("Administrators")) ret.Add("Administrators");
return ret;
}
diff --git a/src/admin/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj b/src/admin/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj
index 1babcfd1..7c36e9e2 100644
--- a/src/admin/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj
+++ b/src/admin/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj
@@ -5,7 +5,7 @@
-
+
diff --git a/src/admin/Bootstrap.DataAccess/Dict.cs b/src/admin/Bootstrap.DataAccess/Dict.cs
index f395dfbf..2896ce1a 100644
--- a/src/admin/Bootstrap.DataAccess/Dict.cs
+++ b/src/admin/Bootstrap.DataAccess/Dict.cs
@@ -65,7 +65,7 @@ namespace Bootstrap.DataAccess
///
///
///
- public virtual string RetrieveWebTitle(string appId = "0")
+ public virtual string RetrieveWebTitle(string appId)
{
// 优先查找配置的应用程序网站标题
var code = DbHelper.RetrieveTitle(appId);
@@ -78,7 +78,7 @@ namespace Bootstrap.DataAccess
///
///
///
- public virtual string RetrieveWebFooter(string appId = "0")
+ public virtual string RetrieveWebFooter(string appId)
{
// 优先查找配置的应用程序网站标题
var code = DbHelper.RetrieveFooter(appId);
@@ -111,16 +111,16 @@ namespace Bootstrap.DataAccess
///
/// 获得默认的前台首页地址,默认为~/Home/Index
///
- ///
+ ///
///
- public virtual string RetrieveHomeUrl(string appCode)
+ public virtual string RetrieveHomeUrl(string appId)
{
// https://gitee.com/LongbowEnterprise/dashboard/issues?id=IS0WK
var url = "~/Home/Index";
var dicts = DictHelper.RetrieveDicts();
- if (appCode != "0")
+ if (!appId.IsNullOrEmpty())
{
- var appUrl = dicts.FirstOrDefault(d => d.Name.Equals(appCode, StringComparison.OrdinalIgnoreCase) && d.Category == "应用首页" && d.Define == 0)?.Code;
+ var appUrl = dicts.FirstOrDefault(d => d.Name.Equals(appId, StringComparison.OrdinalIgnoreCase) && d.Category == "应用首页" && d.Define == 0)?.Code;
if (!string.IsNullOrEmpty(appUrl)) return appUrl;
}
var defaultUrl = dicts.FirstOrDefault(d => d.Name == "前台首页" && d.Category == "网站设置" && d.Define == 0)?.Code;
@@ -129,7 +129,7 @@ namespace Bootstrap.DataAccess
}
///
- ///
+ /// 获得字典表中配置的所有应用程序
///
///
public virtual IEnumerable> RetrieveApps() => DictHelper.RetrieveDicts().Where(d => d.Category == "应用程序" && d.Define == 0).Select(d => new KeyValuePair(d.Code, d.Name)).OrderBy(d => d.Key);
diff --git a/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs b/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs
index e8d42b9e..9e9dd5fe 100644
--- a/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs
+++ b/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs
@@ -126,14 +126,14 @@ namespace Bootstrap.DataAccess
///
///
///
- public static string RetrieveWebTitle(string appId = "0") => DbContextManager.Create().RetrieveWebTitle(appId);
+ public static string RetrieveWebTitle(string appId) => DbContextManager.Create().RetrieveWebTitle(appId);
///
/// 获取站点 Footer 配置信息
///
///
///
- public static string RetrieveWebFooter(string appId = "0") => DbContextManager.Create().RetrieveWebFooter(appId);
+ public static string RetrieveWebFooter(string appId) => DbContextManager.Create().RetrieveWebFooter(appId);
///
/// 获得系统中配置的可以使用的网站样式
@@ -156,9 +156,9 @@ namespace Bootstrap.DataAccess
///
/// 获得默认的前台首页地址,默认为 ~/Home/Index
///
- /// 应用程序编码
+ /// 应用程序编码
///
- public static string RetrieveHomeUrl(string appCode) => DbContextManager.Create().RetrieveHomeUrl(appCode);
+ public static string RetrieveHomeUrl(string appId) => DbContextManager.Create().RetrieveHomeUrl(appId);
///
/// 获取所有应用程序数据方法
diff --git a/src/admin/Bootstrap.DataAccess/Helper/RoleHelper.cs b/src/admin/Bootstrap.DataAccess/Helper/RoleHelper.cs
index ba6666c9..1793ef96 100644
--- a/src/admin/Bootstrap.DataAccess/Helper/RoleHelper.cs
+++ b/src/admin/Bootstrap.DataAccess/Helper/RoleHelper.cs
@@ -148,7 +148,8 @@ namespace Bootstrap.DataAccess
/// 通过指定 Url 地址获得授权角色集合
///
/// 请求 Url 地址
+ /// 应用程序Id
/// 角色名称集合
- public static IEnumerable RetrievesByUrl(string url) => CacheManager.GetOrAdd(string.Format("{0}-{1}", DbHelper.RetrieveRolesByUrlDataKey, url), key => DbContextManager.Create().RetrievesByUrl(url), DbHelper.RetrieveRolesByUrlDataKey);
+ public static IEnumerable RetrievesByUrl(string url, string appId) => CacheManager.GetOrAdd(string.Format("{0}-{1}-{2}", DbHelper.RetrieveRolesByUrlDataKey, url, appId), key => DbContextManager.Create().RetrievesByUrl(url, appId), DbHelper.RetrieveRolesByUrlDataKey);
}
}
diff --git a/src/admin/Bootstrap.DataAccess/Role.cs b/src/admin/Bootstrap.DataAccess/Role.cs
index 7f2a71de..ed9432fd 100644
--- a/src/admin/Bootstrap.DataAccess/Role.cs
+++ b/src/admin/Bootstrap.DataAccess/Role.cs
@@ -193,7 +193,9 @@ namespace Bootstrap.DataAccess
/// 从NavigatorRole表查
/// 从Navigators -> GroupNavigatorRole -> Role查查询某个用户所拥有的角色
///
+ ///
+ ///
///
- public virtual IEnumerable RetrievesByUrl(string url) => DbHelper.RetrieveRolesByUrl(url);
+ public virtual IEnumerable RetrievesByUrl(string url, string appId) => DbHelper.RetrieveRolesByUrl(url, appId);
}
}
diff --git a/src/client/Bootstrap.Client.DataAccess.MongoDB/Dict.cs b/src/client/Bootstrap.Client.DataAccess.MongoDB/Dict.cs
index f28a7155..0483bf54 100644
--- a/src/client/Bootstrap.Client.DataAccess.MongoDB/Dict.cs
+++ b/src/client/Bootstrap.Client.DataAccess.MongoDB/Dict.cs
@@ -23,7 +23,7 @@ namespace Bootstrap.Client.DataAccess.MongoDB
///
///
///
- private string RetrieveAppName(string name, string appId = "0", string defaultValue = "未设置")
+ private string RetrieveAppName(string name, string appId = "", string defaultValue = "未设置")
{
var dicts = DictHelper.RetrieveDicts();
var platName = dicts.FirstOrDefault(d => d.Category == "应用程序" && d.Code == appId)?.Name;
diff --git a/src/client/Bootstrap.Client.DataAccess.MongoDB/Role.cs b/src/client/Bootstrap.Client.DataAccess.MongoDB/Role.cs
index 9c774436..ef898195 100644
--- a/src/client/Bootstrap.Client.DataAccess.MongoDB/Role.cs
+++ b/src/client/Bootstrap.Client.DataAccess.MongoDB/Role.cs
@@ -47,12 +47,13 @@ namespace Bootstrap.Client.DataAccess.MongoDB
/// 从NavigatorRole表查
/// 从Navigators -> GroupNavigatorRole -> Role查查询某个用户所拥有的角色
///
+ ///
+ ///
///
- public override IEnumerable RetrievesByUrl(string url)
+ public override IEnumerable RetrievesByUrl(string url, string appId)
{
var menu = DbManager.Menus.Find(md => md.Url.StartsWith(url)).FirstOrDefault();
- var appId = ConfigurationManager.GetValue("AppId", "2");
- var ret = RoleHelper.Retrieves().Where(md => md.Menus.Any(m => m == menu.Id) && md.Apps.Any(m => m == appId)).Select(m => m.RoleName).ToList();
+ var ret = RoleHelper.Retrieves().Where(md => md.Menus.Any(m => m == menu.Id) && md.Apps.Any(m => m.Equals(appId, StringComparison.OrdinalIgnoreCase))).Select(m => m.RoleName).ToList();
if (!ret.Any(r => r.Equals("Administrators", StringComparison.OrdinalIgnoreCase))) ret.Add("Administrators");
return ret;
}
diff --git a/src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj b/src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj
index 90d7095a..ec7779b5 100644
--- a/src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj
+++ b/src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj
@@ -5,7 +5,7 @@
-
+
diff --git a/src/client/Bootstrap.Client.DataAccess/Helper/RoleHelper.cs b/src/client/Bootstrap.Client.DataAccess/Helper/RoleHelper.cs
index dda5bceb..5d95e2db 100644
--- a/src/client/Bootstrap.Client.DataAccess/Helper/RoleHelper.cs
+++ b/src/client/Bootstrap.Client.DataAccess/Helper/RoleHelper.cs
@@ -21,7 +21,8 @@ namespace Bootstrap.Client.DataAccess
///
///
///
+ ///
///
- public static IEnumerable RetrievesByUrl(string url) => CacheManager.GetOrAdd(string.Format("{0}-{1}", DbHelper.RetrieveRolesByUrlDataKey, url), key => DbContextManager.Create().RetrievesByUrl(url), DbHelper.RetrieveRolesByUrlDataKey);
+ public static IEnumerable RetrievesByUrl(string url, string appId) => CacheManager.GetOrAdd(string.Format("{0}-{1}-{2}", DbHelper.RetrieveRolesByUrlDataKey, url, appId), key => DbContextManager.Create().RetrievesByUrl(url, appId), DbHelper.RetrieveRolesByUrlDataKey);
}
}
diff --git a/src/client/Bootstrap.Client.DataAccess/Role.cs b/src/client/Bootstrap.Client.DataAccess/Role.cs
index f6394775..80f35a9e 100644
--- a/src/client/Bootstrap.Client.DataAccess/Role.cs
+++ b/src/client/Bootstrap.Client.DataAccess/Role.cs
@@ -21,7 +21,9 @@ namespace Bootstrap.Client.DataAccess
/// 从NavigatorRole表查
/// 从Navigators -> GroupNavigatorRole -> Role查查询某个用户所拥有的角色
///
+ ///
+ ///
///
- public virtual IEnumerable RetrievesByUrl(string url) => DbHelper.RetrieveRolesByUrl(url, ConfigurationManager.GetValue("AppId", "2"));
+ public virtual IEnumerable RetrievesByUrl(string url, string appId) => DbHelper.RetrieveRolesByUrl(url, ConfigurationManager.GetValue("AppId", appId));
}
}
diff --git a/src/client/Bootstrap.Client/Bootstrap.Client.csproj b/src/client/Bootstrap.Client/Bootstrap.Client.csproj
index 94b48e4a..4896254c 100644
--- a/src/client/Bootstrap.Client/Bootstrap.Client.csproj
+++ b/src/client/Bootstrap.Client/Bootstrap.Client.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/src/client/Bootstrap.Client/Models/ModelBase.cs b/src/client/Bootstrap.Client/Models/ModelBase.cs
index b93c5b91..63117b9b 100644
--- a/src/client/Bootstrap.Client/Models/ModelBase.cs
+++ b/src/client/Bootstrap.Client/Models/ModelBase.cs
@@ -1,5 +1,5 @@
using Bootstrap.Client.DataAccess;
-using Longbow.Configuration;
+using Bootstrap.Security.Mvc;
namespace Bootstrap.Client.Models
{
@@ -13,7 +13,7 @@ namespace Bootstrap.Client.Models
///
public ModelBase()
{
- AppId = ConfigurationManager.GetValue("AppId", "2");
+ AppId = BootstrapAppContext.AppId;
Title = DictHelper.RetrieveWebTitle(AppId);
Footer = DictHelper.RetrieveWebFooter(AppId);
Theme = DictHelper.RetrieveActiveTheme();
diff --git a/src/client/Bootstrap.Client/Startup.cs b/src/client/Bootstrap.Client/Startup.cs
index 4c10af5a..2a14b5da 100644
--- a/src/client/Bootstrap.Client/Startup.cs
+++ b/src/client/Bootstrap.Client/Startup.cs
@@ -90,7 +90,7 @@ namespace Bootstrap.Client
app.UseRouting();
app.UseCors(builder => builder.WithOrigins(Configuration["AllowOrigins"].Split(',', StringSplitOptions.RemoveEmptyEntries)).AllowAnyHeader().AllowAnyMethod().AllowCredentials());
- app.UseBootstrapAdminAuthentication("2", RoleHelper.RetrievesByUserName, RoleHelper.RetrievesByUrl, AppHelper.RetrievesByUserName);
+ app.UseBootstrapAdminAuthentication(RoleHelper.RetrievesByUserName, RoleHelper.RetrievesByUrl, AppHelper.RetrievesByUserName);
app.UseAuthorization();
app.UseCacheManager();
app.UseOnlineUsers(callback: TraceHelper.Save);
diff --git a/src/client/Bootstrap.Client/appsettings.json b/src/client/Bootstrap.Client/appsettings.json
index 25edaef5..6ebe9962 100644
--- a/src/client/Bootstrap.Client/appsettings.json
+++ b/src/client/Bootstrap.Client/appsettings.json
@@ -37,7 +37,7 @@
}
}
],
- "AppId": 2,
+ "AppId": "Demo",
"BootstrapAdminAuthenticationOptions": {
"AuthHost": "http://argo.zylweb.cn/BA"
},
diff --git a/test/UnitTest/Bootstrap.Admin/Api/SQLServer/InterfaceTest.cs b/test/UnitTest/Bootstrap.Admin/Api/SQLServer/InterfaceTest.cs
index 9b3c696b..b1591385 100644
--- a/test/UnitTest/Bootstrap.Admin/Api/SQLServer/InterfaceTest.cs
+++ b/test/UnitTest/Bootstrap.Admin/Api/SQLServer/InterfaceTest.cs
@@ -40,7 +40,7 @@ namespace Bootstrap.Admin.Api.SqlServer
[Fact]
public async void RetrieveAppMenus_Ok()
{
- var ret = await Client.PostAsJsonAsync>("RetrieveAppMenus", new AppMenuOption() { AppId = "0", UserName = "Admin", Url = "~/Admin/Index" });
+ var ret = await Client.PostAsJsonAsync>("RetrieveAppMenus", new AppMenuOption() { AppId = "", UserName = "Admin", Url = "~/Admin/Index" });
Assert.NotEmpty(ret);
}
}
diff --git a/test/UnitTest/Bootstrap.Admin/Controllers/SQLServer/AccountTest.cs b/test/UnitTest/Bootstrap.Admin/Controllers/SQLServer/AccountTest.cs
index e682c273..b4c555a4 100644
--- a/test/UnitTest/Bootstrap.Admin/Controllers/SQLServer/AccountTest.cs
+++ b/test/UnitTest/Bootstrap.Admin/Controllers/SQLServer/AccountTest.cs
@@ -1,5 +1,4 @@
using Bootstrap.DataAccess;
-using System;
using System.Linq;
using System.Net;
using System.Net.Http;
diff --git a/test/UnitTest/Bootstrap.Admin/HttpClientExtensions.cs b/test/UnitTest/Bootstrap.Admin/HttpClientExtensions.cs
index 20064f71..9ca0f761 100644
--- a/test/UnitTest/Bootstrap.Admin/HttpClientExtensions.cs
+++ b/test/UnitTest/Bootstrap.Admin/HttpClientExtensions.cs
@@ -1,7 +1,4 @@
-using Microsoft.Extensions.DependencyInjection;
-using System.Net.Http;
-using System.Net.Http.Headers;
-using System.Text.Json;
+using System.Net.Http;
using System.Threading.Tasks;
namespace Bootstrap.Admin
diff --git a/test/UnitTest/Bootstrap.DataAccess/SQLServer/DictsTest.cs b/test/UnitTest/Bootstrap.DataAccess/SQLServer/DictsTest.cs
index 1c8d66bb..f1ad4d19 100644
--- a/test/UnitTest/Bootstrap.DataAccess/SQLServer/DictsTest.cs
+++ b/test/UnitTest/Bootstrap.DataAccess/SQLServer/DictsTest.cs
@@ -4,7 +4,6 @@ using System;
using System.Linq;
using System.Net.Http;
using System.Text.Json;
-using System.Threading;
using Xunit;
namespace Bootstrap.DataAccess.SqlServer
@@ -58,13 +57,13 @@ namespace Bootstrap.DataAccess.SqlServer
[Fact]
public void RetrieveWebTitle_Ok()
{
- Assert.Equal("后台管理系统", DictHelper.RetrieveWebTitle());
+ Assert.Equal("后台管理系统", DictHelper.RetrieveWebTitle("BA"));
}
[Fact]
public void RetrieveWebFooter_Ok()
{
- Assert.Equal("2016 © 通用后台管理系统", DictHelper.RetrieveWebFooter());
+ Assert.Equal("2016 © 通用后台管理系统", DictHelper.RetrieveWebFooter("BA"));
}
[Fact]
@@ -88,7 +87,7 @@ namespace Bootstrap.DataAccess.SqlServer
[Fact]
public void RetrieveHomeUrl_Ok()
{
- Assert.Equal("~/Home/Index", DictHelper.RetrieveHomeUrl("0"));
+ Assert.Equal("~/Home/Index", DictHelper.RetrieveHomeUrl(string.Empty));
var url = DictHelper.RetrieveHomeUrl("2");
Assert.NotEqual("~/Home/Index", url);
diff --git a/test/UnitTest/Bootstrap.DataAccess/SQLServer/RolesTest.cs b/test/UnitTest/Bootstrap.DataAccess/SQLServer/RolesTest.cs
index 2edb50a2..6e1695ac 100644
--- a/test/UnitTest/Bootstrap.DataAccess/SQLServer/RolesTest.cs
+++ b/test/UnitTest/Bootstrap.DataAccess/SQLServer/RolesTest.cs
@@ -86,7 +86,7 @@ namespace Bootstrap.DataAccess.SqlServer
[Fact]
public void RetrieveRolesByUrl_Ok()
{
- Assert.NotEmpty(RoleHelper.RetrievesByUrl("~/Home/Index"));
+ Assert.NotEmpty(RoleHelper.RetrievesByUrl("~/Home/Index", "BA"));
}
[Fact]