use envisage
go
update SecurityObject set Type = 'Area' where Type = 'MainMenu'
go
if not exists (select 1 from dbo.SecurityObject so where so.Name = 'Units of Measure' and so.Type = 'Area')
insert into SecurityObject values('cbfa2ea0-303f-4335-85b9-e9f5a581f4e5', 'Units of Measure', 'Area')
go
if not exists (select 1 from dbo.SecurityObject so where so.Name = 'Import actuals' and so.Type = 'Area')
insert into SecurityObject values('e0db8c9d-6997-4738-9157-30a8fc402247', 'Import actuals', 'Area')
go
if not exists (select 1 from dbo.SecurityObject so where so.Name = 'Scenario Templates' and so.Type = 'Area')
insert into SecurityObject values('8a5eda75-2892-4262-9947-a32b94141b98', 'Scenario Templates', 'Area')
go
if not exists (select 1 from dbo.SecurityObject so where so.Name = 'Fiscal Calendar' and so.Type = 'Area')
insert into SecurityObject values('a1b60582-3551-42b4-b1ea-24f5db5dee63', 'Fiscal Calendar', 'Area')
go
if not exists (select 1 from dbo.SecurityObject so where so.Name = 'Project Statuses' and so.Type = 'Area')
insert into SecurityObject values('077362d6-c162-463f-82c1-9360391a64af', 'Project Statuses', 'Area')
go
if not exists (select 1 from dbo.SecurityObject so where so.Name = 'Project Classifications' and so.Type = 'Area')
insert into SecurityObject values('94f9422f-c0b3-410c-87db-19e49e71a384', 'Project Classifications', 'Area')
go
if not exists (select 1 from dbo.SecurityObject so where so.Name = 'Expenditures' and so.Type = 'Area')
insert into SecurityObject values('89fae05f-d6a9-488b-9064-3a6daf92dccd', 'Expenditures', 'Area')
go
if not exists (select 1 from dbo.SecurityObject so where so.Name = 'GL Departments' and so.Type = 'Area')
insert into SecurityObject values('155c9c6b-0e30-40fe-bef1-510c0271babf', 'GL Departments', 'Area')
go
if not exists (select 1 from dbo.SecurityObject so where so.Name = 'Credit Departments' and so.Type = 'Area')
insert into SecurityObject values('aa356254-58db-4726-839e-1397638ad06a', 'Credit Departments', 'Area')
go
if not exists (select 1 from dbo.SecurityObject so where so.Name = 'Clients' and so.Type = 'Area')
insert into SecurityObject values('c79a4fec-5279-4370-8161-6b08ae0ef433', 'Clients', 'Area')
go
if not exists (select 1 from dbo.SecurityObject so where so.Name = 'Company' and so.Type = 'Area')
insert into SecurityObject values('7ff0d894-060f-401f-99cd-6710dcf3cdf0', 'Company', 'Area')
go
if not exists (select 1 from dbo.SecurityObject so where so.Name = 'Users' and so.Type = 'Area')
insert into SecurityObject values('a1ea9df3-3538-4694-83a4-7312ae87d33d', 'Users', 'Area')
go
if not exists (select 1 from dbo.SecurityObject so where so.Name = 'Roles' and so.Type = 'Area')
insert into SecurityObject values('b34af044-cb70-4d1c-ad2e-5bdd1e0ca502', 'Roles', 'Area')
go

if not exists (select 1 from dbo.Security so where so.PrincipalId = '156D9357-9563-49B0-A8CA-FC0DBD86BB17' and so.SecurityObjectId = 'b34af044-cb70-4d1c-ad2e-5bdd1e0ca502')
insert into Security values('156D9357-9563-49B0-A8CA-FC0DBD86BB17', 'b34af044-cb70-4d1c-ad2e-5bdd1e0ca502', '1', 1, 1)
go
if not exists (select 1 from dbo.Security so where so.PrincipalId = '156D9357-9563-49B0-A8CA-FC0DBD86BB17' and so.SecurityObjectId = 'a1ea9df3-3538-4694-83a4-7312ae87d33d')
insert into Security values('156D9357-9563-49B0-A8CA-FC0DBD86BB17', 'a1ea9df3-3538-4694-83a4-7312ae87d33d', '1', 1, 1)
go