Removed specific user group and roles. The records must be dynamic.
parent
fdb08acd21
commit
74d68f2329
|
@ -7,13 +7,3 @@ begin
|
||||||
UserGroupName varchar(50) not null
|
UserGroupName varchar(50) not null
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not exists (select top 1 1 from UserGroup)
|
|
||||||
begin
|
|
||||||
insert into UserGroup(UserGroupCode, UserGroupName)
|
|
||||||
values ('ADMINISTRATORS', 'Administrators'),
|
|
||||||
('USERS', 'Users'),
|
|
||||||
('DEVELOPERS', 'Developers'),
|
|
||||||
('VIEWERS', 'Viewers'),
|
|
||||||
('GUESTS', 'Guests')
|
|
||||||
end
|
|
|
@ -7,16 +7,3 @@ begin
|
||||||
UserRoleName varchar(50) not null
|
UserRoleName varchar(50) not null
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not exists (select top 1 1 from UserRole)
|
|
||||||
begin
|
|
||||||
insert into UserRole(UserRoleCode, UserRoleName)
|
|
||||||
values ('SYSTEM_ADMINISTRATOR', 'System administrator'),
|
|
||||||
('FULLSTACK_DEVELOPER', 'Fullstack developer'),
|
|
||||||
('POWER_USER', 'Power user'),
|
|
||||||
('REGULAR_USER', 'Regular user'),
|
|
||||||
('READONLY_USER', 'Readonly user'),
|
|
||||||
('ANONYMOUS_USER', 'Anonymous user'),
|
|
||||||
('DEMO_USER', 'Demo user')
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
|
|
||||||
declare @admin_group_id int, @admin_role_id int
|
|
||||||
|
|
||||||
select @admin_group_id = UserGroupId from UserGroup where UserGroupCode = 'ADMINISTRATORS'
|
|
||||||
select @admin_role_id = UserRoleId from UserRole where UserRoleCode = 'SYSTEM_ADMINISTRATOR'
|
|
||||||
|
|
||||||
if not exists (select top 1 1 from UserGroupXUserRole where UserGroupId = @admin_group_id and UserRoleId = @admin_role_id)
|
|
||||||
begin
|
|
||||||
insert into UserGroupXUserRole (UserGroupId, UserRoleId)
|
|
||||||
values (@admin_group_id, @admin_role_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
declare @developer_group_id int, @developer_role_id int
|
|
||||||
|
|
||||||
select @developer_group_id = UserGroupId from UserGroup where UserGroupCode = 'DEVELOPERS'
|
|
||||||
select @developer_role_id = UserRoleId from UserRole where UserRoleCode = 'FULLSTACK_DEVELOPER'
|
|
||||||
|
|
||||||
if not exists (select top 1 1 from UserGroupXUserRole where UserGroupId = @developer_group_id and UserRoleId = @developer_role_id)
|
|
||||||
begin
|
|
||||||
insert into UserGroupXUserRole (UserGroupId, UserRoleId)
|
|
||||||
values (@developer_group_id, @developer_role_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
declare @user_group_id int, @user_role_id int
|
|
||||||
|
|
||||||
select @user_group_id = UserGroupId from UserGroup where UserGroupCode = 'USERS'
|
|
||||||
select @user_role_id = UserRoleId from UserRole where UserRoleCode = 'REGULAR_USER'
|
|
||||||
|
|
||||||
if not exists (select top 1 1 from UserGroupXUserRole where UserGroupId = @user_group_id and UserRoleId = @user_role_id)
|
|
||||||
begin
|
|
||||||
insert into UserGroupXUserRole (UserGroupId, UserRoleId)
|
|
||||||
values (@user_group_id, @user_role_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
declare @viewer_group_id int, @viewer_role_id int
|
|
||||||
|
|
||||||
select @viewer_group_id = UserGroupId from UserGroup where UserGroupCode = 'VIEWERS'
|
|
||||||
select @viewer_role_id = UserRoleId from UserRole where UserRoleCode = 'READONLY_USER'
|
|
||||||
|
|
||||||
if not exists (select top 1 1 from UserGroupXUserRole where UserGroupId = @viewer_group_id and UserRoleId = @viewer_role_id)
|
|
||||||
begin
|
|
||||||
insert into UserGroupXUserRole (UserGroupId, UserRoleId)
|
|
||||||
values (@viewer_group_id, @viewer_role_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
declare @guest_group_id int, @guest_role_id int
|
|
||||||
|
|
||||||
select @guest_group_id = UserGroupId from UserGroup where UserGroupCode = 'GUESTS'
|
|
||||||
select @guest_role_id = UserRoleId from UserRole where UserRoleCode = 'ANONYMOUS_USER'
|
|
||||||
|
|
||||||
if not exists (select top 1 1 from UserGroupXUserRole where UserGroupId = @guest_group_id and UserRoleId = @guest_role_id)
|
|
||||||
begin
|
|
||||||
insert into UserGroupXUserRole (UserGroupId, UserRoleId)
|
|
||||||
values (@guest_group_id, @guest_role_id)
|
|
||||||
end
|
|
|
@ -43,9 +43,6 @@
|
||||||
<None Update="Scripts\2.4.0\03.New tables UserXUserGroup UserGroupXUserRole UserXUserRole.sql">
|
<None Update="Scripts\2.4.0\03.New tables UserXUserGroup UserGroupXUserRole UserXUserRole.sql">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Update="Scripts\2.4.0\04.Link user groups and roles.sql">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
Loading…
Reference in New Issue