declare @RoleActionRoleScopes table(
	[UserRoleId] [int] NOT NULL,
	[ActionId] [int] NOT NULL,
	[TargetRoleId] [int] NOT NULL,
	[Allowed] [bit] NOT NULL
)


--Member roles
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and r2.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and r2.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and r2.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and r2.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and r2.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and r2.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='31EBDBC3-8596-4448-A063-1D462772118A' and r2.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='14665214-632A-4729-B22B-892CC31B1894' and r2.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and r2.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and r2.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and r2.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and r2.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and r2.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and r2.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and r2.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and r2.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and r2.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='31EBDBC3-8596-4448-A063-1D462772118A' and r2.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='14665214-632A-4729-B22B-892CC31B1894' and r2.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and r2.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and r2.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and r2.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and r2.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and r2.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and r2.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and r2.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and r2.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and r2.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='31EBDBC3-8596-4448-A063-1D462772118A' and r2.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='14665214-632A-4729-B22B-892CC31B1894' and r2.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and r2.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and r2.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and r2.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and r2.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and r2.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and r2.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and r2.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and r2.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and r2.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='31EBDBC3-8596-4448-A063-1D462772118A' and r2.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='14665214-632A-4729-B22B-892CC31B1894' and r2.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and r2.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and r2.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and r2.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and r2.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and r2.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and r2.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and r2.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and r2.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and r2.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='31EBDBC3-8596-4448-A063-1D462772118A' and r2.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='14665214-632A-4729-B22B-892CC31B1894' and r2.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and r2.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and r2.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and r2.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and r2.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and r2.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and r2.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and r2.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and r2.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and r2.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='31EBDBC3-8596-4448-A063-1D462772118A' and r2.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='14665214-632A-4729-B22B-892CC31B1894' and r2.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and r2.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and r2.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and r2.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and r2.guid='14665214-632A-4729-B22B-892CC31B1894' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and r2.guid='14665214-632A-4729-B22B-892CC31B1894' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and r2.guid='14665214-632A-4729-B22B-892CC31B1894' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and r2.guid='14665214-632A-4729-B22B-892CC31B1894' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and r2.guid='14665214-632A-4729-B22B-892CC31B1894' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and r2.guid='14665214-632A-4729-B22B-892CC31B1894' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='31EBDBC3-8596-4448-A063-1D462772118A' and r2.guid='14665214-632A-4729-B22B-892CC31B1894' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='14665214-632A-4729-B22B-892CC31B1894' and r2.guid='14665214-632A-4729-B22B-892CC31B1894' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and r2.guid='14665214-632A-4729-B22B-892CC31B1894' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and r2.guid='14665214-632A-4729-B22B-892CC31B1894' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and r2.guid='14665214-632A-4729-B22B-892CC31B1894' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and r2.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and r2.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and r2.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and r2.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and r2.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and r2.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='31EBDBC3-8596-4448-A063-1D462772118A' and r2.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='14665214-632A-4729-B22B-892CC31B1894' and r2.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and r2.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and r2.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and r2.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and r2.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and r2.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and r2.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and r2.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and r2.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and r2.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='31EBDBC3-8596-4448-A063-1D462772118A' and r2.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='14665214-632A-4729-B22B-892CC31B1894' and r2.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and r2.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and r2.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and r2.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and r2.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and r2.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and r2.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and r2.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and r2.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and r2.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='31EBDBC3-8596-4448-A063-1D462772118A' and r2.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='14665214-632A-4729-B22B-892CC31B1894' and r2.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and r2.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and r2.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and r2.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and a.guid in ('E956D023-A3AB-47A2-B3BC-6BFF99337B10','27061901-5A98-4754-90E5-2D46243E5050','BC09021F-6411-45D1-8BB2-752BC8D0495F','0C9D3EA6-DF44-4ACD-A854-06EC8EE6A2E9')


-- AssociatedPanel roles
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='62FD0F19-43D8-4F1E-B7C7-57A8D17A0131' and r2.guid='31EBDBC3-8596-4448-A063-1D462772118A' and a.guid in ('C77E1B9C-C59C-4003-AC35-31C1E3E4FED2','12BB55A5-EE3D-4759-8147-93C1F6130367','214A539A-2C0E-4761-8551-866D95DDC85A','8A5D98C8-9494-4701-A4B0-7B25E36B0E19')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='1BF4E983-EC11-4A4C-B02B-8F2F7631DAA9' and r2.guid='31EBDBC3-8596-4448-A063-1D462772118A' and a.guid in ('C77E1B9C-C59C-4003-AC35-31C1E3E4FED2','12BB55A5-EE3D-4759-8147-93C1F6130367','214A539A-2C0E-4761-8551-866D95DDC85A','8A5D98C8-9494-4701-A4B0-7B25E36B0E19')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='31EBDBC3-8596-4448-A063-1D462772118A' and r2.guid='31EBDBC3-8596-4448-A063-1D462772118A' and a.guid in ('C77E1B9C-C59C-4003-AC35-31C1E3E4FED2','12BB55A5-EE3D-4759-8147-93C1F6130367','214A539A-2C0E-4761-8551-866D95DDC85A','8A5D98C8-9494-4701-A4B0-7B25E36B0E19')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='14665214-632A-4729-B22B-892CC31B1894' and r2.guid='31EBDBC3-8596-4448-A063-1D462772118A' and a.guid in ('C77E1B9C-C59C-4003-AC35-31C1E3E4FED2','12BB55A5-EE3D-4759-8147-93C1F6130367','214A539A-2C0E-4761-8551-866D95DDC85A','8A5D98C8-9494-4701-A4B0-7B25E36B0E19')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='0E9CB844-06B6-4AEA-A0DC-0FC17EE71BE2' and r2.guid='31EBDBC3-8596-4448-A063-1D462772118A' and a.guid in ('C77E1B9C-C59C-4003-AC35-31C1E3E4FED2','12BB55A5-EE3D-4759-8147-93C1F6130367','214A539A-2C0E-4761-8551-866D95DDC85A','8A5D98C8-9494-4701-A4B0-7B25E36B0E19')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='A508E668-94BC-4076-A8EE-972ADAD06E64' and r2.guid='31EBDBC3-8596-4448-A063-1D462772118A' and a.guid in ('C77E1B9C-C59C-4003-AC35-31C1E3E4FED2','12BB55A5-EE3D-4759-8147-93C1F6130367','214A539A-2C0E-4761-8551-866D95DDC85A','8A5D98C8-9494-4701-A4B0-7B25E36B0E19')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='F1C4B065-85CF-46C3-B262-E4FE26D9BA58' and r2.guid='31EBDBC3-8596-4448-A063-1D462772118A' and a.guid in ('C77E1B9C-C59C-4003-AC35-31C1E3E4FED2','12BB55A5-EE3D-4759-8147-93C1F6130367','214A539A-2C0E-4761-8551-866D95DDC85A','8A5D98C8-9494-4701-A4B0-7B25E36B0E19')

insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and r2.guid='31EBDBC3-8596-4448-A063-1D462772118A' 
and a.guid in ('C77E1B9C-C59C-4003-AC35-31C1E3E4FED2','12BB55A5-EE3D-4759-8147-93C1F6130367','214A539A-2C0E-4761-8551-866D95DDC85A')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='A6B2BFC3-D2E0-4496-81D0-224F77085DA5' and r2.guid='31EBDBC3-8596-4448-A063-1D462772118A' 
and a.guid in ('8A5D98C8-9494-4701-A4B0-7B25E36B0E19')

insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and r2.guid='31EBDBC3-8596-4448-A063-1D462772118A' 
and a.guid in ('C77E1B9C-C59C-4003-AC35-31C1E3E4FED2','12BB55A5-EE3D-4759-8147-93C1F6130367','214A539A-2C0E-4761-8551-866D95DDC85A')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D4F9CE6E-C39F-4179-B2FB-A02F2E4C86B6' and r2.guid='31EBDBC3-8596-4448-A063-1D462772118A' 
and a.guid in ('8A5D98C8-9494-4701-A4B0-7B25E36B0E19')


insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and r2.guid='31EBDBC3-8596-4448-A063-1D462772118A' 
and a.guid in ('C77E1B9C-C59C-4003-AC35-31C1E3E4FED2','214A539A-2C0E-4761-8551-866D95DDC85A')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='D0275602-E7DF-420F-9E29-77AF67A7B844' and r2.guid='31EBDBC3-8596-4448-A063-1D462772118A' 
and a.guid in ('12BB55A5-EE3D-4759-8147-93C1F6130367','8A5D98C8-9494-4701-A4B0-7B25E36B0E19')

insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,1 from roles r1,roles r2, roleactiontypes a where r1.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and r2.guid='31EBDBC3-8596-4448-A063-1D462772118A' 
and a.guid in ('C77E1B9C-C59C-4003-AC35-31C1E3E4FED2')
insert into @RoleActionRoleScopes (userroleid,actionid,targetroleid,allowed) select r1.id,a.id,r2.id,0 from roles r1,roles r2, roleactiontypes a where r1.guid='B7B24D8B-3ACE-4B6B-8581-6ABD4375470A' and r2.guid='31EBDBC3-8596-4448-A063-1D462772118A' 
and a.guid in ('12BB55A5-EE3D-4759-8147-93C1F6130367','214A539A-2C0E-4761-8551-866D95DDC85A','8A5D98C8-9494-4701-A4B0-7B25E36B0E19')



MERGE INTO [dbo].RoleActionRoleScopes AS TARGET
USING @RoleActionRoleScopes AS SOURCE
	ON	TARGET.userroleid = SOURCE.userroleid and
		TARGET.targetroleid = SOURCE.targetroleid and
		TARGET.actionid = SOURCE.actionid
	WHEN MATCHED THEN    
			UPDATE SET allowed=source.allowed
	WHEN NOT MATCHED BY TARGET THEN   
			INSERT ( userroleid,actionid,targetroleid,allowed) VALUES (Source.userroleid,Source.actionid,Source.targetroleid,Source.allowed)  
OUTPUT $action, SOURCE.*;
