Commit c78d1b04 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

add write privilege

parent b72c54ed
--remove artifacts (privileges to non-existing projects)
delete from privilege_table where (type = 'VIEW_PROJECT' or type ='EDIT_COMMENTS_PROJECT') and not id_object in (select id from project_table);
delete from privilege_table where (type = 'VIEW_PROJECT' or type ='EDIT_COMMENTS_PROJECT' or type='LAYOUT_MANAGEMENT') and not id_object in (select id from project_table);
alter table privilege_table rename column id_object to object_id;
delete from privilege_table where level = 0;
......@@ -34,6 +34,12 @@ from (select user_id, object_id from privilege_table where type = 'VIEW_PROJECT'
inner join (select id, object_id from privilege_table where type = 'READ_PROJECT') s2
on s1.object_id = s2.object_id;
insert into user_privilege_map_table (user_id, privilege_id)
select s1.user_id, s2.id
from (select user_id, object_id from privilege_table where type = 'EDIT_COMMENTS_PROJECT' or type = 'LAYOUT_MANAGEMENT') s1
inner join (select id, object_id from privilege_table where type = 'WRITE_PROJECT') s2
on s1.object_id = s2.object_id;
insert into user_privilege_map_table (user_id, privilege_id)
select s1.user_id, s2.id
from (select user_id, object_id from privilege_table where type = 'VIEW_PROJECT' and user_id in (select user_id from privilege_table where type = 'ADD_MAP')) s1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment