db: 增加 Default 角色对 Demo BA 授权脚本

This commit is contained in:
Argo Windows 2019-10-28 23:43:50 +08:00
parent 15638a7d6e
commit eceb9c11b6
6 changed files with 10 additions and 10 deletions

View File

@ -10,6 +10,6 @@
"RoleName": "Default",
"Description": "默认用户,可访问前台页面",
"Menus": [],
"Apps": []
"Apps": ["BA", "Demo"]
}
];

View File

@ -170,9 +170,9 @@ INSERT into Navigations (ParentId, Name, `Order`, Icon, Url, Category, Applicati
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= '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 = 'Demo';
DELETE From RoleApp where AppId in ('Demo', 'BA');
INSERT INTO RoleApp (AppId, RoleId) SELECT 'Demo', ID From Roles Where RoleName = 'Default';
INSERT INTO RoleApp (AppId, RoleId) SELECT 'BA', ID From Roles Where RoleName = 'Default';

View File

@ -175,9 +175,9 @@ INSERT into [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category
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] = '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 = 'Demo';
INSERT INTO RoleApp (AppId, RoleId) SELECT 'Demo', ID From Roles Where RoleName = 'Default';
DELETE From RoleApp where AppId in ('Demo', 'BA');
INSERT INTO RoleApp (AppId, RoleId) SELECT 'Demo', ID From Roles Where RoleName = 'Default';
INSERT INTO RoleApp (AppId, RoleId) SELECT 'BA', 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 [fa fa-fa],
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 (BA) COLLATE NOCASE
Application VARCHAR (200) DEFAULT [BA] COLLATE NOCASE
);
CREATE TABLE NavigationRole(

View File

@ -182,9 +182,9 @@ INSERT [dbo].[Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Categor
INSERT into [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (0, N'返回码云', 20, 'fa fa-fa', 'https://gitee.com/LongbowEnterprise/BootstrapAdmin', '1', @AppId)
-- 菜单授权
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] = @AppId;
INSERT INTO NavigationRole SELECT n.ID, r.ID FROM Navigations n left join Roles r on 1=1 Where r.RoleName = 'Default' and [Application] = @AppId
-- 角色对应用授权
DELETE From RoleApp where AppId = @AppId;
INSERT INTO RoleApp (AppId, RoleId) SELECT @AppId, ID From Roles Where RoleName = 'Default'
INSERT INTO RoleApp (AppId, RoleId) SELECT 'BA', ID From Roles Where RoleName = 'Default'