Index: openacs.org-dev/packages/forums/sql/postgresql/forums-forums-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs.org-dev/packages/forums/sql/postgresql/forums-forums-create.sql,v diff -u -N -r1.1 -r1.2 --- openacs.org-dev/packages/forums/sql/postgresql/forums-forums-create.sql 9 Jul 2002 17:35:09 -0000 1.1 +++ openacs.org-dev/packages/forums/sql/postgresql/forums-forums-create.sql 10 Jul 2002 18:42:30 -0000 1.2 @@ -10,34 +10,32 @@ -- -- privileges -create function inline_0 () -returns integer as ' -begin +begin; -- moderate and post are new privileges -- the rest are obvious inheritance -- forum creation on a package allows a user to create forums -- forum creation on a forum allows a user to create new threads - perform acs_privilege__create_privilege(''forum_create'',null,null); - perform acs_privilege__create_privilege(''forum_write'',null,null); - perform acs_privilege__create_privilege(''forum_delete'',null,null); - perform acs_privilege__create_privilege(''forum_read'',null,null); - perform acs_privilege__create_privilege(''forum_post'',null,null); - perform acs_privilege__create_privilege(''forum_moderate'',null,null); + select acs_privilege__create_privilege('forum_create',null,null); + select acs_privilege__create_privilege('forum_write',null,null); + select acs_privilege__create_privilege('forum_delete',null,null); + select acs_privilege__create_privilege('forum_read',null,null); + select acs_privilege__create_privilege('forum_post',null,null); + select acs_privilege__create_privilege('forum_moderate',null,null); -- 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; -- add children - perform acs_privilege__add_child(''create'',''forum_create''); - perform acs_privilege__add_child(''write'',''forum_write''); - perform acs_privilege__add_child(''delete'',''forum_delete''); - perform acs_privilege__add_child(''admin'',''forum_moderate''); - perform acs_privilege__add_child(''forum_moderate'',''forum_read''); - perform acs_privilege__add_child(''forum_moderate'',''forum_post''); - perform acs_privilege__add_child(''forum_write'',''forum_read''); - perform acs_privilege__add_child(''forum_write'',''forum_post''); + select acs_privilege__add_child('create','forum_create'); + select acs_privilege__add_child('write','forum_write'); + select acs_privilege__add_child('delete','forum_delete'); + select acs_privilege__add_child('admin','forum_moderate'); + select acs_privilege__add_child('forum_moderate','forum_read'); + select acs_privilege__add_child('forum_moderate','forum_post'); + select acs_privilege__add_child('forum_write','forum_read'); + select acs_privilege__add_child('forum_write','forum_post'); -- re-enable the trigger before the last insert to force the -- acs_privilege_hierarchy_index table to be updated. @@ -47,14 +45,11 @@ execute procedure acs_priv_hier_ins_del_tr (); -- the last one that will cause all the updates - perform acs_privilege__add_child(''read'',''forum_read''); + select acs_privilege__add_child('read','forum_read'); - return null; -end;' language 'plpgsql'; + --return null; +end; -select inline_0(); -drop function inline_0 (); - create table forums_forums ( forum_id integer constraint forums_forum_id_nn Index: openacs.org-dev/packages/forums/sql/postgresql/forums-notifications-sanitize.sql =================================================================== RCS file: /usr/local/cvsroot/openacs.org-dev/packages/forums/sql/postgresql/forums-notifications-sanitize.sql,v diff -u -N -r1.1 -r1.2 --- openacs.org-dev/packages/forums/sql/postgresql/forums-notifications-sanitize.sql 9 Jul 2002 17:35:09 -0000 1.1 +++ openacs.org-dev/packages/forums/sql/postgresql/forums-notifications-sanitize.sql 10 Jul 2002 18:42:30 -0000 1.2 @@ -25,3 +25,112 @@ select inline_0(); drop function inline_0 (); + +-- +-- Service contract drop stuff was missing - Roberto Mello +-- + +create function inline_0() returns integer as ' +declare + impl_id integer; + v_foo integer; +begin + + -- the notification type impl + impl_id := acs_sc_impl__get_id ( + ''NotificationType'', -- impl_contract_name + ''forums_forum_notif_type'' -- impl_name + ); + + PERFORM acs_sc_binding__delete ( + ''NotificationType'', + ''forums_forum_notif_type'' + ); + + v_foo := acs_sc_impl_alias__delete ( + ''NotificationType'', -- impl_contract_name + ''forums_forum_notif_type'', -- impl_name + ''GetURL'' -- impl_operation_name + ); + + v_foo := acs_sc_impl_alias__delete ( + ''NotificationType'', -- impl_contract_name + ''forums_forum_notif_type'', -- impl_name + ''ProcessReply'' -- impl_operation_name + ); + + select into v_foo type_id + from notification_types + where sc_impl_id = impl_id + and short_name = ''forums_forum_notif''; + + perform notification_type__delete (v_foo); + + delete from notification_types_intervals + where type_id = v_foo + and interval_id in ( + select interval_id + from notification_intervals + where name in (''instant'',''hourly'',''daily'') + ); + + delete from notification_types_del_methods + where type_id = v_foo + and delivery_method_id in ( + select delivery_method_id + from notification_delivery_methods + where short_name in (''email'') + ); + + -- the notification type impl + impl_id := acs_sc_impl__get_id ( + ''NotificationType'', + ''forums_message_notif_type'' + ); + + PERFORM acs_sc_binding__delete ( + ''NotificationType'', + ''forums_message_notif_type'' + ); + + v_foo := acs_sc_impl_alias__delete ( + ''NotificationType'', + ''forums_message_notif_type'', + ''GetURL'' + ); + + v_foo := acs_sc_impl_alias__delete ( + ''NotificationType'', + ''forums_message_notif_type'', + ''ProcessReply'' + ); + + select into v_foo type_id + from notification_types + where sc_impl_id = impl_id + and short_name = ''forums_message_notif''; + + perform notification_type__delete (v_foo); + + delete from notification_types_intervals + where type_id = v_foo + and interval_id in ( + select interval_id + from notification_intervals + where name in (''instant'',''hourly'',''daily'') + ); + + delete from notification_types_del_methods + where type_id = v_foo + and delivery_method_id in ( + select delivery_method_id + from notification_delivery_methods + where short_name in (''email'') + ); + + return (0); +end; +' language 'plpgsql'; + +select inline_0(); +drop function inline_0();