-- 
-- 
-- 
-- @author Jade Rubick (jader@bread.com)
-- @creation-date 2004-07-12
-- @arch-tag: 07fd5cd9-0605-4497-ab58-7f0933c34ac8
-- @cvs-id $Id: upgrade-0.1d-0.2d.sql,v 1.2 2004/07/24 08:33:58 jeffd Exp $
--

-- let's do the permissions stuff
begin;
    -- temporarily drop this trigger to avoid a data-change violation 
    -- on acs_privilege_hierarchy_index while updating the child privileges.

    drop trigger acs_priv_hier_ins_del_tr on acs_privilege_hierarchy;

    -- bind privileges to global names
    select acs_privilege__remove_child('create','room_reservation_create');
    select acs_privilege__remove_child('write','room_reservation_modify');
    select acs_privilege__remove_child('read','room_reservation_view');
    select acs_privilege__remove_child('delete','room_reservation_delete');

    select acs_privilege__remove_child('admin','room_reservation_admin');


    select acs_privilege__remove_child('room_reservation_admin','room_reservation_view');
    select acs_privilege__remove_child('room_reservation_admin','room_reservation_create');
    select acs_privilege__remove_child('room_reservation_admin','room_reservation_delete');

    -- re-enable the trigger before the last delete to force the 
    -- acs_privilege_hierarchy_index table to be updated.

    create trigger acs_priv_hier_ins_del_tr after insert or delete
    on acs_privilege_hierarchy for each row
    execute procedure acs_priv_hier_ins_del_tr ();

    select acs_privilege__remove_child('room_reservation_admin','room_reservation_modify');

    select acs_privilege__drop_privilege('room_reservation_view');
    select acs_privilege__drop_privilege('room_reservation_create');
    select acs_privilege__drop_privilege('room_reservation_delete');
    select acs_privilege__drop_privilege('room_reservation_modify');
    select acs_privilege__drop_privilege('room_reservation_admin');
end;

