refactor: 后台应用默认使用配置项 AppId 值

This commit is contained in:
Argo Windows 2019-10-27 23:46:22 +08:00 committed by Argo Zhang
parent 932aa8f24b
commit 479f553bc2
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
48 changed files with 234 additions and 216 deletions

View File

@ -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)
},

View File

@ -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"
}
];

View File

@ -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';
DELETE From RoleApp where AppId = 'Demo';
INSERT INTO RoleApp (AppId, RoleId) SELECT 'Demo', ID From Roles Where RoleName = 'Default';

View File

@ -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(

View File

@ -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);

View File

@ -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';
DELETE From RoleApp where AppId = 'Demo';
INSERT INTO RoleApp (AppId, RoleId) SELECT 'Demo', ID From Roles Where RoleName = 'Default';

View File

@ -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(

View File

@ -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);

View File

@ -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]

View File

@ -10,12 +10,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Bootstrap.Security.Mvc" Version="3.0.2-beta3" />
<PackageReference Include="Bootstrap.Security.Mvc" Version="3.0.2-beta4" />
<PackageReference Include="Longbow.Logging" Version="3.0.2-beta1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="4.0.0-preview8.19405.7" />
<PackageReference Include="Sentry.AspNetCore" Version="2.0.0-beta4" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc4" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.6.0" />
</ItemGroup>
<ItemGroup>

View File

@ -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
/// <param name="appId"></param>
/// <returns></returns>
[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
/// <param name="userName">User name.</param>
/// <param name="password">Password.</param>
/// <param name="remember">Remember.</param>
/// <param name="appId"></param>
[HttpPost]
public async Task<IActionResult> Login(string userName, string password, string remember, string appId = "0")
public async Task<IActionResult> 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<IActionResult> SignInAsync(string userName, bool persistent, string authenticationScheme = CookieAuthenticationDefaults.AuthenticationScheme)
@ -163,10 +163,10 @@ namespace Bootstrap.Admin.Controllers
/// <param name="appId"></param>
/// <returns>The logout.</returns>
[HttpGet]
public async Task<IActionResult> Logout([FromQuery]string appId = "0")
public async Task<IActionResult> 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));
}
/// <summary>

View File

@ -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
{
/// <summary>
///
/// 接口控制器
/// </summary>
[Route("api/[controller]/[action]")]
[AllowAnonymous]
@ -16,7 +18,7 @@ namespace Bootstrap.Admin.Controllers
public class InterfaceController : ControllerBase
{
/// <summary>
///
/// 获取所有字典表数据
/// </summary>
/// <returns></returns>
[HttpPost]
@ -24,17 +26,19 @@ namespace Bootstrap.Admin.Controllers
{
return DictHelper.RetrieveDicts();
}
/// <summary>
///
/// 通过请求地址获取相对应角色集合
/// </summary>
/// <returns></returns>
[HttpPost]
public IEnumerable<string> RetrieveRolesByUrl([FromBody]string url)
{
return RoleHelper.RetrievesByUrl(url);
return RoleHelper.RetrievesByUrl(url, BootstrapAppContext.AppId);
}
/// <summary>
///
/// 通过用户名获得分配所有角色
/// </summary>
/// <returns></returns>
[HttpPost]
@ -42,8 +46,9 @@ namespace Bootstrap.Admin.Controllers
{
return RoleHelper.RetrievesByUserName(userName);
}
/// <summary>
///
/// 通过用户名获得 User 实例
/// </summary>
/// <returns></returns>
[HttpPost]
@ -51,9 +56,11 @@ namespace Bootstrap.Admin.Controllers
{
return UserHelper.RetrieveUserByUserName(new GenericIdentity(userName));
}
/// <summary>
///
/// 通过指定条件获得应用程序菜单
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
[HttpPost]
public IEnumerable<BootstrapMenu> RetrieveAppMenus([FromBody]AppMenuOption args)

View File

@ -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
{

View File

@ -7,25 +7,26 @@ using Microsoft.AspNetCore.Mvc;
namespace Bootstrap.Admin.Controllers
{
/// <summary>
///
/// Home Controller
/// </summary>
[Authorize]
public class HomeController : Controller
{
/// <summary>
///
/// Index View
/// </summary>
/// <returns></returns>
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);
}
/// <summary>
///
/// Error View
/// </summary>
/// <param name="id"></param>
/// <returns></returns>

View File

@ -1,4 +1,5 @@
using Bootstrap.DataAccess;
using Bootstrap.Security.Mvc;
namespace Bootstrap.Admin.Models
{
@ -11,8 +12,10 @@ namespace Bootstrap.Admin.Models
/// 默认构造函数
/// </summary>
/// <param name="appId"></param>
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();

View File

@ -1,16 +1,17 @@
using Bootstrap.DataAccess;
using Bootstrap.Security.Mvc;
using System;
using System.Security.Principal;
namespace Bootstrap.Admin.Models
{
/// <summary>
///
/// Header Model
/// </summary>
public class HeaderBarModel : AdminModel
{
/// <summary>
///
/// 默认构造函数
/// </summary>
/// <param name="identity"></param>
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);
}
}
/// <summary>
///
/// 获得 当前用户登录名
/// </summary>
public string UserName { get; }
/// <summary>
///
/// 获得 当前用户显示名称
/// </summary>
public string DisplayName { get; }
/// <summary>
/// 获得/设置 用户头像地址
/// 获得 用户头像地址
/// </summary>
public string Icon { get; }
/// <summary>
/// 获取/设置 个人网站样式
/// 获取 个人网站样式
/// </summary>
public string Css { get; }

View File

@ -11,7 +11,7 @@ namespace Bootstrap.Admin.Models
/// 默认构造函数
/// </summary>
/// <param name="appId"></param>
public LoginModel(string appId = "0") : base(appId)
public LoginModel(string appId = null) : base(appId)
{
ImageLibUrl = DictHelper.RetrieveImagesLibUrl();
}

View File

@ -9,5 +9,10 @@
/// 获取 网站 logo 小图标
/// </summary>
public string WebSiteIcon { get; protected set; } = "~/favicon.ico";
/// <summary>
/// 获得 网站图标
/// </summary>
public string WebSiteLogo { get; protected set; } = "~/favicon.png";
}
}

View File

@ -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)));
}
/// <summary>
/// 获得 网站图标
/// </summary>
public string WebSiteLogo { get; protected set; }
/// <summary>
/// 获得 网站菜单
/// </summary>

View File

@ -33,7 +33,7 @@ namespace Bootstrap.Admin.Query
/// <summary>
///
/// </summary>
public string AppCode { get; set; }
public string AppId { get; set; }
/// <summary>
///
@ -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<object>();
ret.total = data.Count();

View File

@ -111,7 +111,7 @@ namespace Bootstrap.Admin
app.UseRouting();
app.UseCors(builder => builder.WithOrigins(Configuration["AllowOrigins"].Split(',', StringSplitOptions.RemoveEmptyEntries)).AllowAnyHeader().AllowAnyMethod().AllowCredentials());
app.UseBootstrapAdminAuthentication("", RoleHelper.RetrievesByUserName, RoleHelper.RetrievesByUrl, AppHelper.RetrievesByUserName);
app.UseBootstrapAdminAuthentication(RoleHelper.RetrievesByUserName, RoleHelper.RetrievesByUrl, AppHelper.RetrievesByUserName);
app.UseAuthorization();
app.UseSwagger(Configuration["SwaggerPathBase"].TrimEnd('/'));
app.UseCacheManager();

View File

@ -172,7 +172,7 @@
</div>
<div class="form-group col-sm-6">
<label class="control-label" for="app">所属应用</label>
<select data-toggle="lgbSelect" class="d-none" data-default-val="0" id="app">
<select data-toggle="lgbSelect" class="d-none" data-default-val="@BootstrapAppContext.AppId" id="app">
@foreach (var kv in Model.Applications)
{
<option value="@kv.Key">@kv.Value</option>

View File

@ -112,7 +112,7 @@
<a href="~/Admin/Notifications"><i class="fa fa-bell"></i>通知<span id="logoutNoti" class="badge badge-pill badge-success"></span></a>
</div>
<div class="dropdown-item">
<a href="~/Account/Logout?appId=@Model.AppId"><i class="fa fa-key"></i>注销</a>
<a href="~/Account/Logout"><i class="fa fa-key"></i>注销</a>
</div>
</div>
</div>

View File

@ -1,4 +1,5 @@
@using Bootstrap.Admin.Models
@using Bootstrap.Security.Mvc
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Bootstrap.Security.Mvc
@addTagHelper *, Longbow.Web

View File

@ -53,6 +53,7 @@
}
}
],
"AppId": "BA",
"SwaggerPathBase": "",
"AllowOrigins": "http://localhost,http://ba.sdgxgz.cn",
"GiteeHealthChecks": false,

View File

@ -76,7 +76,7 @@ $(function () {
pageSize: 100,
pageList: [100, 200, 400],
sortName: 'Order',
queryParams: function (params) { return $.extend(params, { parentName: $('#txt_parent_menus_name').val().trim(), name: $("#txt_menus_name").val().trim(), category: $('#sel_menus_category').val(), isresource: $('#sel_menus_res').val(), appCode: $('#sel_app').val() }); }, //传递参数(*
queryParams: function (params) { return $.extend(params, { parentName: $('#txt_parent_menus_name').val().trim(), name: $("#txt_menus_name").val().trim(), category: $('#sel_menus_category').val(), isresource: $('#sel_menus_res').val(), appId: $('#sel_app').val() }); }, //传递参数(*
exportOptions: {
fileName: "菜单数据",
ignoreColumn: [0, 9]

View File

@ -66,7 +66,7 @@ namespace Bootstrap.DataAccess.MongoDB
return true;
}
private static string RetrieveAppName(string name, string appId = "0", string defaultValue = "未设置")
private static string RetrieveAppName(string name, string appId = "", string defaultValue = "未设置")
{
var dicts = DictHelper.RetrieveDicts();
var platName = dicts.FirstOrDefault(d => d.Category == "应用程序" && d.Code == appId)?.Name;
@ -78,7 +78,7 @@ namespace Bootstrap.DataAccess.MongoDB
/// </summary>
/// <param name="appId"></param>
/// <returns></returns>
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
/// </summary>
/// <param name="appId"></param>
/// <returns></returns>
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;
}

View File

@ -1,4 +1,5 @@
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Linq;
@ -193,11 +194,12 @@ namespace Bootstrap.DataAccess.MongoDB
///
/// </summary>
/// <param name="url"></param>
/// <param name="appId"></param>
/// <returns></returns>
public override IEnumerable<string> RetrievesByUrl(string url)
public override IEnumerable<string> RetrievesByUrl(string url, string appId)
{
var menu = DbManager.Menus.Find(md => md.Url.StartsWith(url)).FirstOrDefault();
var ret = RoleHelper.Retrieves().Cast<Role>().Where(md => md.Menus != null && md.Menus.Contains(menu.Id)).Select(m => m.RoleName).ToList();
var ret = RoleHelper.Retrieves().Cast<Role>().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;
}

View File

@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Bootstrap.Security.DataAccess" Version="3.0.0" />
<PackageReference Include="Bootstrap.Security.DataAccess" Version="3.0.1-beta1" />
<PackageReference Include="Longbow" Version="3.0.0" />
<PackageReference Include="Longbow.Cache" Version="3.0.0" />
<PackageReference Include="Longbow.Configuration" Version="3.0.0" />

View File

@ -65,7 +65,7 @@ namespace Bootstrap.DataAccess
/// </summary>
/// <param name="appId"></param>
/// <returns></returns>
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
/// </summary>
/// <param name="appId"></param>
/// <returns></returns>
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
/// <summary>
/// 获得默认的前台首页地址,默认为~/Home/Index
/// </summary>
/// <param name="appCode"></param>
/// <param name="appId"></param>
/// <returns></returns>
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
}
/// <summary>
///
/// 获得字典表中配置的所有应用程序
/// </summary>
/// <returns></returns>
public virtual IEnumerable<KeyValuePair<string, string>> RetrieveApps() => DictHelper.RetrieveDicts().Where(d => d.Category == "应用程序" && d.Define == 0).Select(d => new KeyValuePair<string, string>(d.Code, d.Name)).OrderBy(d => d.Key);

View File

@ -126,14 +126,14 @@ namespace Bootstrap.DataAccess
/// </summary>
/// <param name="appId"></param>
/// <returns></returns>
public static string RetrieveWebTitle(string appId = "0") => DbContextManager.Create<Dict>().RetrieveWebTitle(appId);
public static string RetrieveWebTitle(string appId) => DbContextManager.Create<Dict>().RetrieveWebTitle(appId);
/// <summary>
/// 获取站点 Footer 配置信息
/// </summary>
/// <param name="appId"></param>
/// <returns></returns>
public static string RetrieveWebFooter(string appId = "0") => DbContextManager.Create<Dict>().RetrieveWebFooter(appId);
public static string RetrieveWebFooter(string appId) => DbContextManager.Create<Dict>().RetrieveWebFooter(appId);
/// <summary>
/// 获得系统中配置的可以使用的网站样式
@ -156,9 +156,9 @@ namespace Bootstrap.DataAccess
/// <summary>
/// 获得默认的前台首页地址,默认为 ~/Home/Index
/// </summary>
/// <param name="appCode">应用程序编码</param>
/// <param name="appId">应用程序编码</param>
/// <returns></returns>
public static string RetrieveHomeUrl(string appCode) => DbContextManager.Create<Dict>().RetrieveHomeUrl(appCode);
public static string RetrieveHomeUrl(string appId) => DbContextManager.Create<Dict>().RetrieveHomeUrl(appId);
/// <summary>
/// 获取所有应用程序数据方法

View File

@ -148,7 +148,8 @@ namespace Bootstrap.DataAccess
/// 通过指定 Url 地址获得授权角色集合
/// </summary>
/// <param name="url">请求 Url 地址</param>
/// <param name="appId">应用程序Id</param>
/// <returns>角色名称集合</returns>
public static IEnumerable<string> RetrievesByUrl(string url) => CacheManager.GetOrAdd(string.Format("{0}-{1}", DbHelper.RetrieveRolesByUrlDataKey, url), key => DbContextManager.Create<Role>().RetrievesByUrl(url), DbHelper.RetrieveRolesByUrlDataKey);
public static IEnumerable<string> RetrievesByUrl(string url, string appId) => CacheManager.GetOrAdd(string.Format("{0}-{1}-{2}", DbHelper.RetrieveRolesByUrlDataKey, url, appId), key => DbContextManager.Create<Role>().RetrievesByUrl(url, appId), DbHelper.RetrieveRolesByUrlDataKey);
}
}

View File

@ -193,7 +193,9 @@ namespace Bootstrap.DataAccess
/// 从NavigatorRole表查
/// 从Navigators -> GroupNavigatorRole -> Role查查询某个用户所拥有的角色
/// </summary>
/// <param name="url"></param>
/// <param name="appId"></param>
/// <returns></returns>
public virtual IEnumerable<string> RetrievesByUrl(string url) => DbHelper.RetrieveRolesByUrl(url);
public virtual IEnumerable<string> RetrievesByUrl(string url, string appId) => DbHelper.RetrieveRolesByUrl(url, appId);
}
}

View File

@ -23,7 +23,7 @@ namespace Bootstrap.Client.DataAccess.MongoDB
/// <param name="appId"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
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;

View File

@ -47,12 +47,13 @@ namespace Bootstrap.Client.DataAccess.MongoDB
/// 从NavigatorRole表查
/// 从Navigators -> GroupNavigatorRole -> Role查查询某个用户所拥有的角色
/// </summary>
/// <param name="url"></param>
/// <param name="appId"></param>
/// <returns></returns>
public override IEnumerable<string> RetrievesByUrl(string url)
public override IEnumerable<string> 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;
}

View File

@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Bootstrap.Security.DataAccess" Version="3.0.0" />
<PackageReference Include="Bootstrap.Security.DataAccess" Version="3.0.1-beta1" />
<PackageReference Include="Longbow" Version="3.0.0" />
<PackageReference Include="Longbow.Cache" Version="3.0.0" />
<PackageReference Include="Longbow.Configuration" Version="3.0.0" />

View File

@ -21,7 +21,8 @@ namespace Bootstrap.Client.DataAccess
///
/// </summary>
/// <param name="url"></param>
/// <param name="appId"></param>
/// <returns></returns>
public static IEnumerable<string> RetrievesByUrl(string url) => CacheManager.GetOrAdd(string.Format("{0}-{1}", DbHelper.RetrieveRolesByUrlDataKey, url), key => DbContextManager.Create<Role>().RetrievesByUrl(url), DbHelper.RetrieveRolesByUrlDataKey);
public static IEnumerable<string> RetrievesByUrl(string url, string appId) => CacheManager.GetOrAdd(string.Format("{0}-{1}-{2}", DbHelper.RetrieveRolesByUrlDataKey, url, appId), key => DbContextManager.Create<Role>().RetrievesByUrl(url, appId), DbHelper.RetrieveRolesByUrlDataKey);
}
}

View File

@ -21,7 +21,9 @@ namespace Bootstrap.Client.DataAccess
/// 从NavigatorRole表查
/// 从Navigators -> GroupNavigatorRole -> Role查查询某个用户所拥有的角色
/// </summary>
/// <param name="url"></param>
/// <param name="appId"></param>
/// <returns></returns>
public virtual IEnumerable<string> RetrievesByUrl(string url) => DbHelper.RetrieveRolesByUrl(url, ConfigurationManager.GetValue("AppId", "2"));
public virtual IEnumerable<string> RetrievesByUrl(string url, string appId) => DbHelper.RetrieveRolesByUrl(url, ConfigurationManager.GetValue("AppId", appId));
}
}

View File

@ -6,7 +6,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Bootstrap.Security.Mvc" Version="3.0.2-beta3" />
<PackageReference Include="Bootstrap.Security.Mvc" Version="3.0.2-beta4" />
<PackageReference Include="Longbow.Logging" Version="3.0.2-beta1" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="3.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.6.0" />

View File

@ -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
/// </summary>
public ModelBase()
{
AppId = ConfigurationManager.GetValue("AppId", "2");
AppId = BootstrapAppContext.AppId;
Title = DictHelper.RetrieveWebTitle(AppId);
Footer = DictHelper.RetrieveWebFooter(AppId);
Theme = DictHelper.RetrieveActiveTheme();

View File

@ -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);

View File

@ -37,7 +37,7 @@
}
}
],
"AppId": 2,
"AppId": "Demo",
"BootstrapAdminAuthenticationOptions": {
"AuthHost": "http://argo.zylweb.cn/BA"
},

View File

@ -40,7 +40,7 @@ namespace Bootstrap.Admin.Api.SqlServer
[Fact]
public async void RetrieveAppMenus_Ok()
{
var ret = await Client.PostAsJsonAsync<AppMenuOption, IEnumerable<BootstrapMenu>>("RetrieveAppMenus", new AppMenuOption() { AppId = "0", UserName = "Admin", Url = "~/Admin/Index" });
var ret = await Client.PostAsJsonAsync<AppMenuOption, IEnumerable<BootstrapMenu>>("RetrieveAppMenus", new AppMenuOption() { AppId = "", UserName = "Admin", Url = "~/Admin/Index" });
Assert.NotEmpty(ret);
}
}

View File

@ -1,5 +1,4 @@
using Bootstrap.DataAccess;
using System;
using System.Linq;
using System.Net;
using System.Net.Http;

View File

@ -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

View File

@ -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);

View File

@ -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]