Skip to content

Commit

Permalink
RANGER-2691: Fix MsSQL syntax in patch
Browse files Browse the repository at this point in the history
Signed-off-by: Mehul Parikh <mehul@apache.org>
  • Loading branch information
terjekid authored and mehulbparikh committed Jan 10, 2020
1 parent d991dbb commit eb5aac4
Showing 1 changed file with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -447,25 +447,24 @@ BEGIN
IF EXISTS(select name from x_service_def where name like 'atlas.%')
BEGIN
DECLARE @new_atlas_def_name VARCHAR(100);
set @new_atlas_def_name=(select name into new_atlas_def_name from x_service_def where name like 'atlas.%')
set @new_atlas_def_name=(select name from x_service_def where name like 'atlas.%')
IF EXISTS(select * from x_access_type_def where def_id in(select id from x_service_def where name='tag') and name in('atlas:read','atlas:create','atlas:update','atlas:delete','atlas:all'))
BEGIN
update x_access_type_def set name=concat(new_atlas_def_name , ':read') where def_id=100 and name='atlas:read';
update x_access_type_def set name=concat(new_atlas_def_name , ':create') where def_id=100 and name='atlas:create';
update x_access_type_def set name=concat(new_atlas_def_name , ':update') where def_id=100 and name='atlas:update';
update x_access_type_def set name=concat(new_atlas_def_name , ':delete') where def_id=100 and name='atlas:delete';
update x_access_type_def set name=concat(new_atlas_def_name , ':all') where def_id=100 and name='atlas:all';
END IF;
update x_access_type_def set name=concat(@new_atlas_def_name , ':read') where def_id=100 and name='atlas:read';
update x_access_type_def set name=concat(@new_atlas_def_name , ':create') where def_id=100 and name='atlas:create';
update x_access_type_def set name=concat(@new_atlas_def_name , ':update') where def_id=100 and name='atlas:update';
update x_access_type_def set name=concat(@new_atlas_def_name , ':delete') where def_id=100 and name='atlas:delete';
update x_access_type_def set name=concat(@new_atlas_def_name , ':all') where def_id=100 and name='atlas:all';
END
IF EXISTS(select * from x_access_type_def_grants where atd_id in (select id from x_access_type_def where def_id in (select id from x_service_def where name='tag') and name like 'atlas%') and implied_grant in ('atlas:read','atlas:create','atlas:update','atlas:delete','atlas:all'))
BEGIN
update x_access_type_def_grants set implied_grant=concat(new_atlas_def_name , ':read') where implied_grant='atlas:read';
update x_access_type_def_grants set implied_grant=concat(new_atlas_def_name , ':create') where implied_grant='atlas:create';
update x_access_type_def_grants set implied_grant=concat(new_atlas_def_name , ':update') where implied_grant='atlas:update';
update x_access_type_def_grants set implied_grant=concat(new_atlas_def_name , ':delete') where implied_grant='atlas:delete';
update x_access_type_def_grants set implied_grant=concat(new_atlas_def_name , ':all') where implied_grant='atlas:all';
END IF;
END IF;
END IF;
update x_access_type_def_grants set implied_grant=concat(@new_atlas_def_name , ':read') where implied_grant='atlas:read';
update x_access_type_def_grants set implied_grant=concat(@new_atlas_def_name , ':create') where implied_grant='atlas:create';
update x_access_type_def_grants set implied_grant=concat(@new_atlas_def_name , ':update') where implied_grant='atlas:update';
update x_access_type_def_grants set implied_grant=concat(@new_atlas_def_name , ':delete') where implied_grant='atlas:delete';
update x_access_type_def_grants set implied_grant=concat(@new_atlas_def_name , ':all') where implied_grant='atlas:all';
END
END
END
GO
EXIT

0 comments on commit eb5aac4

Please sign in to comment.