Index: openacs-4/packages/acs-kernel/sql/postgresql/test/acs-objects-test.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/test/acs-objects-test.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-kernel/sql/postgresql/test/acs-objects-test.sql 22 Mar 2001 00:21:19 -0000 1.1 @@ -0,0 +1,311 @@ +-- +-- acs-kernel/sql/acs-objects-test.sql +-- +-- PL/SQL regression tests for the acs-objects system +-- +-- Note: These tests use the utPLSQL regression package available at: +-- ftp://ftp.oreilly.com/published/oreilly/oracle/utplsql/utplsql.zip +-- +-- @author Richard Li (richardl@arsdigita.com) +-- +-- @creation-date 19 September 2000 +-- +-- @cvs-id $Id: acs-objects-test.sql,v 1.1 2001/03/22 00:21:19 danw Exp $ + +-- In order for utPLSQL to work, you need to grant +-- specific permissions to your user: +-- +-- grant create public synonym to servicename; +-- grant drop public synonym to servicename; +-- grant execute on dbms_pipe to servicename; +-- grant drop any table to servicename; +-- grant create any table to servicename; + +-- In order to execute the test, you need to set things up +-- in your SQL*PLUS session. First type: +-- +-- set serveroutput on size 1000000 format wrapped +-- +-- Now, if you have the UTL_FILE PL/SQL package installed, type: +-- +-- exec utplsql.setdir('/web/richard/packages/acs-kernel/sql'); +-- +-- Otherwise, you'll have to disable autocompilation and manually +-- compile: +-- +-- exec utplsql.autocompile (false); +-- @acs-objects-test +-- +-- To actually execute the test, type: +-- +-- exec utplsql.test('acs_object'); + + +-- we need these here or else the PL/SQL won't compile. +-- drop table ut_acs_objects; +-- create table ut_acs_objects as select * from acs_objects; +-- create table test_objects (test_id integer primary key, data varchar2(100)); + +-- create or replace package ut#acs_object +-- as + +-- procedure setup; + +-- procedure teardown; + +-- procedure new; + +-- procedure delete; + +-- procedure name; + +-- procedure default_name; + +-- procedure set_attribute; + +-- procedure get_attribute; + +-- end ut#acs_object; +-- / +-- show errors + +-- create or replace package body ut#acs_object +-- as + +drop function ut_acs_object__setup(); +create function ut_acs_object__setup() returns integer as ' +declare + attr_id acs_attributes.attribute_id%TYPE; +begin + raise NOTICE ''Setting up...''; + + -- create the test_object type + PERFORM acs_object_type__create_type ( + ''test_object'', + ''Test Object'', + ''Test Objects'', + ''acs_object'', + ''test_objects'', + ''test_id'', + null, + ''f'', + null, + null + ); + + -- no API available for this yet + insert into acs_object_type_tables + (object_type, table_name, id_column) + values + (''test_object'',''test_objects'',''test_id''); + + -- create the attribute + attr_id := acs_attribute__create_attribute ( + ''test_object'', + ''data'', + ''string'', + ''Data'', + ''Mo Data'', + ''test_objects'', + ''data'', + null, + 0, + 1, + null, + ''type_specific'', + ''f'' + ); + + return null; + +end;' language 'plpgsql'; + +drop function ut_acs_object__teardown(); +create function ut_acs_object__teardown() returns integer as ' +begin + raise NOTICE ''Tearing down...''; + + -- delete the test object + delete from acs_attributes where object_type = ''test_object''; + delete from acs_object_type_tables where object_type = ''test_object''; + delete from acs_objects where object_type = ''test_object''; + + drop table test_objects; + + -- clean out the test data + drop table ut_acs_objects; + + -- delete the object_type + delete from acs_object_types where object_type = ''test_object''; + + return null; + +end;' language 'plpgsql'; + +drop function ut_acs_object__new(); +create function ut_acs_object__new() returns integer as ' +declare + result boolean; +begin + raise NOTICE ''Testing new...''; + + -- Tests just the common functionality of the API. + + if acs_object__new(-1000, ''test_object'') <> -1000 then + raise NOTICE ''Creating a new test object failed''; + end if; + + -- create a new object to delete; note that this test assumes that + -- the .new operator works. + + if acs_object__new(-1001, ''test_object'') <> -1001 then + raise NOTICE ''Creating a new test object failed''; + end if; + + if acs_object__new(-1003, ''test_object'') <> -1003 then + raise NOTICE ''Creating a new test object failed''; + end if; + + -- create an object + + insert into ut_acs_objects + (object_id, object_type, creation_date, + security_inherit_p, last_modified) + values + (-1000, ''test_object'', now(), ''t'', now()); + + -- Verify that the API does the correct insert. + + select ''t'' into result + from ut_acs_objects uo, acs_objects o + where uo.object_id = o.object_id + and uo.object_id = -1000; + + if NOT FOUND then + raise NOTICE ''Comparing created data for object failed''; + end if; + + return null; + +end;' language 'plpgsql'; + +drop function ut_acs_object__delete(); +create function ut_acs_object__delete() returns integer as ' +declare + v_rec record; +begin + raise NOTICE ''Testing delete...''; + + -- delete the row. + PERFORM acs_object__delete(-1001); + + -- verify object not there. + + select * into v_rec + from acs_objects where object_id = -1001; + + if FOUND then + raise NOTICE ''Delete verification failed''; + end if; + + return null; + +end;' language 'plpgsql'; + +drop function ut_acs_object__name(); +create function ut_acs_object__name() returns integer as ' +begin + raise NOTICE ''Testing name...''; + + if acs_object__name(-1001) <> ''Test Object -1000'' then + raise NOTICE ''Creating a name failed''; + end if; + + return null; + +end;' language 'plpgsql'; + +drop function ut_acs_object__default_name(); +create function ut_acs_object__default_name() returns integer as ' +begin + raise NOTICE ''Testing default_name...''; + + if acs_object__default_name(-1001) <> ''Test Object -1000'' then + raise NOTICE ''Creating a default name failed''; + end if; + + return null; + +end;' language 'plpgsql'; + +drop function ut_acs_object__set_attribute(); +create function ut_acs_object__set_attribute() returns integer as ' +declare + v_sql_result test_objects.data%TYPE; +begin + raise NOTICE ''Testing set_attribute''; + + -- since we did not create a test object new constructor + -- were going to insert into attributes here. + insert into test_objects(test_id) values(-1003); + + PERFORM acs_object__set_attribute(-1003, ''data'', ''2702''); + + -- since utassert is not powerful enough right now, we do this + -- comparison manually + select data into v_sql_result + from test_objects + where test_id = -1003; + + if v_sql_result = 2702 then + raise NOTICE ''SUCCESS: set_attribute''; + else + raise NOTICE ''Verifying attribute data FAILED''; + end if; + + return null; + +end;' language 'plpgsql'; + +drop function ut_acs_object__get_attribute(); +create function ut_acs_object__get_attribute() returns integer as ' +declare + v_attr_value varchar(4000); +begin + raise NOTICE ''Testing get_attribute''; + + -- we assume that set attribute works. since im lazy + -- im going to recycle the -1003 object. + + PERFORM acs_object__set_attribute(-1003, ''data'', ''sugarwen''); + + v_attr_value := acs_object__get_attribute(-1003, ''data''); + + if v_attr_value = ''sugarwen'' then + raise NOTICE ''SUCCESS: get_attribute''; + else + raise NOTICE ''Verifying get attribute data FAILED''; + end if; + + return null; + +end;' language 'plpgsql'; + +create table test_objects ( + test_id integer primary key, + data varchar(100) +); + +select ut_acs_object__setup(); + +create table ut_acs_objects as +select * from acs_objects; + +select ut_acs_object__new(); +select ut_acs_object__delete(); +select ut_acs_object__name(); +select ut_acs_object__default_name(); +select ut_acs_object__set_attribute(); +select ut_acs_object__get_attribute(); + +select ut_acs_object__teardown(); Index: openacs-4/packages/acs-kernel/sql/postgresql/test/groups-test.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/test/groups-test.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-kernel/sql/postgresql/test/groups-test.sql 22 Mar 2001 00:21:19 -0000 1.1 @@ -0,0 +1,170 @@ +-- +-- packages/acs-kernel/sql/test/groups-test.sql +-- +-- @author rhs@mit.edu +-- @creation-date 2000-10-07 +-- @cvs-id $Id: groups-test.sql,v 1.1 2001/03/22 00:21:19 danw Exp $ +-- + +-- set serveroutput on + +create table groups_test_groups ( + group_id integer, + sorder integer, + gname varchar(100) +); + +create table groups_test_users ( + user_id integer, + sorder integer, + uname varchar(100) +); + +create function test_groups() returns integer as ' +declare + A integer; + B integer; + C integer; + D integer; + E integer; + F integer; + G integer; + + joe integer; + jane integer; + bob integer; + betty integer; + jack integer; + jill integer; + sven integer; + stacy integer; + + rel_a integer; + rel_b integer; + rel_c integer; + rel_d integer; + rel_e integer; + rel_f integer; + rel_g integer; + rel_h integer; + rel_i integer; + rel_j integer; + rel_k integer; + rel_l integer; + gp record; + n_rows integer; +begin + -- Create the test groups. + + A := acs_group__new(''A''); + B := acs_group__new(''B''); + C := acs_group__new(''C''); + D := acs_group__new(''D''); + E := acs_group__new(''E''); + F := acs_group__new(''F''); + G := acs_group__new(''G''); + + insert into groups_test_groups values (A,1,''A''); + insert into groups_test_groups values (B,2,''B''); + insert into groups_test_groups values (C,3,''C''); + insert into groups_test_groups values (D,4,''D''); + insert into groups_test_groups values (E,5,''E''); + insert into groups_test_groups values (F,6,''F''); + insert into groups_test_groups values (G,7,''G''); + + -- Create the test members. + joe := acs_user__new(''joe@asdf.com'',''Joe'', + ''Smith'',''assword'',''p''); + jane := acs_user__new(''jane@asdf.com'',''Jane'', + ''Smith'',''assword'',''p''); + bob := acs_user__new(''bob@asdf.com'',''Bob'', + ''Smith'',''assword'',''p''); + betty := acs_user__new(''betty@asdf.com'',''Betty'', + ''Smith'',''assword'',''p''); + jack := acs_user__new(''jack@asdf.com'',''Jack'', + ''Smith'',''assword'',''p''); + jill := acs_user__new(''jill@asdf.com'',''Jill'', + ''Smith'',''assword'',''p''); + sven := acs_user__new(''sven@asdf.com'',''Sven'', + ''Smith'',''assword'',''p''); + stacy := acs_user__new(''stacy@asdf.com'',''Stacy'', + ''Smith'',''assword'',''p''); + + insert into groups_test_users values (joe,1,''joe''); + insert into groups_test_users values (jane,2,''jane''); + insert into groups_test_users values (bob,3,''bob''); + insert into groups_test_users values (betty,4,''betty''); + insert into groups_test_users values (jack,5,''jack''); + insert into groups_test_users values (jill,6,''jill''); + insert into groups_test_users values (sven,7,''sven''); + insert into groups_test_users values (stacy,8,''stacy''); + + -- Make a couple of compositions. + + rel_a := composition_rel__new(A, B); + rel_b := composition_rel__new(A, C); + rel_c := composition_rel__new(A, D); + rel_d := composition_rel__new(E, A); + rel_e := composition_rel__new(F, A); + rel_f := composition_rel__new(G, A); + + -- Make a couple of memberships. + + rel_g := membership_rel__new(B, joe); + rel_h := membership_rel__new(B, jane); + rel_i := membership_rel__new(B, betty); + rel_j := membership_rel__new(A, bob); + rel_k := membership_rel__new(A, betty); + rel_l := membership_rel__new(E, betty); + + delete from acs_logs; + + return null; + +end;' language 'plpgsql'; + +create function check_groups () returns integer as ' +declare + gp record; + v_rec record; +begin + for gp in select * from groups order by group_name LOOP + if NOT acs_group__check_representation(gp.group_id) then + raise notice ''Group % (%) failed'', gp.group_name, gp.group_id; + else + raise notice ''Group % (%) passed'', gp.group_name, gp.group_id; + end if; + end LOOP; + + for v_rec in select group_id from groups_test_groups order by sorder desc + LOOP + raise notice ''dropping %'', v_rec.group_id; + PERFORM acs_group__delete(v_rec.group_id); + end LOOP; + + delete from groups_test_groups; + + for v_rec in select user_id from groups_test_users order by sorder + LOOP + raise notice ''dropping %'', v_rec.user_id; + PERFORM acs_user__delete(v_rec.user_id); + end LOOP; + delete from groups_test_users; + + return null; + +end;' language 'plpgsql'; + +select test_groups(); +select check_groups(); + +drop table groups_test_groups; +drop table groups_test_users; + +drop function test_groups(); +drop function check_groups(); + +select log_level, log_key, message +from acs_logs +where log_level = 'error'; + Index: openacs-4/packages/acs-kernel/sql/postgresql/test/rel-constraints-test.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/test/rel-constraints-test.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-kernel/sql/postgresql/test/rel-constraints-test.sql 22 Mar 2001 00:21:19 -0000 1.1 @@ -0,0 +1,363 @@ +-- +-- packages/acs-kernel/sql/test/rel-constraints-test.sql +-- +-- @author oumi@arsdigita.com +-- @creation-date 2000-12-02 +-- @cvs-id rel-constraints-test.sql,v 1.1.4.1 2001/01/12 23:06:33 oumi Exp +-- + +-- set serveroutput on +create table groups_test_groups ( + group_id integer, + sorder integer, + gname varchar(100) +); + +create table groups_test_users ( + user_id integer, + sorder integer, + uname varchar(100) +); + +create function rel_constraint_dump_views() returns integer as ' + r record; + str varchar; +begin + + raise NOTICE ''Contents of view ''rel_constraints_violated_one'':''; + + for r in select * from rel_constraints_violated_one + LOOP + str := rpad(r.constraint_id, 10) || + rpad(r.rel_id, 10) || + rpad(acs_object__name(r.container_id), 20) || + rpad(acs_object__name(r.party_id), 20); + + raise NOTICE ''%'', str; + end LOOP; + + + raise NOTICE ''Contents of view ''rel_constraints_violated_two'':''; + + for r in select * from rel_constraints_violated_two + LOOP + str := rpad(r.constraint_id, 10) || + rpad(r.rel_id, 10) || + rpad(acs_object__name(r.container_id), 20) || + rpad(acs_object__name(r.party_id), 20); + + raise NOTICE ''%'', str; + end loop; + + return null; + +end;' language 'plpgsql'; + +create function rel_constraint_test_check (integer, boolean) +returns integer as ' +declare + rel_id alias for $1; + expect_violation_p alias for $2; + v_violation_msg varchar(4000); + v_violation_p boolean; + v_object_id_one integer; + v_object_id_two integer; + v_rel_type acs_rels.rel_type%TYPE; + str varchar; +begin + + v_violation_p := ''f''; + + v_violation_msg := rel_constraint__violation(rel_id); + + if v_violation_msg is not null then + v_violation_p := ''t''; + end if; + + if v_violation_p != expect_violation_p then + + select object_id_one, object_id_two, rel_type + into v_object_id_one, v_object_id_two, v_rel_type + from acs_rels + where rel_id = rel_constraint_test_check.rel_id; + + str := ''Relation '' || acs_object_name(rel_id) || + '' ('' || rel_id || '')'' || + '' failed (violation_p = '' || v_violation_p || ''). '' || + ''Rel info: type = '' || v_rel_type || + '', object one = '' || + acs_object__name(v_object_id_one) || + '' ('' || v_object_id_one || '')'' || + '', object two = '' || + acs_object__name(v_object_id_two) || + '' ('' || v_object_id_two || '').''; + + PERFORM acs_log__error(''rel_constraint_test_check'', str); + + raise NOTICE ''%'', str; + + raise NOTICE ''Violation Message:''; + raise NOTICE ''%'', v_violation_msg; + + end if; + + return null; + +end;' language 'plpgsql'; + +-- creates blah_member_rel and yippe_member_rel relationships + +\i rel-segments-test-types-create.sql + +create function test_rel_constraints() returns integer as ' +declare + A integer; + B integer; + C integer; + D integer; + E integer; + F integer; + G integer; + + joe integer; + jane integer; + bob integer; + betty integer; + jack integer; + jill integer; + sven integer; + stacy integer; + + reg_users integer; + + rel_id integer; + + side_one_constraint integer; + side_two_constraint integer; + + v_count integer; + + r record; + +begin + -- Create the test groups. + A := acs_group__new(''A''); + B := acs_group__new(''B''); + C := acs_group__new(''C''); + D := acs_group__new(''D''); + E := acs_group__new(''E''); + F := acs_group__new(''F''); + G := acs_group__new(''G''); + + insert into groups_test_groups values (A,1,''A''); + insert into groups_test_groups values (B,2,''B''); + insert into groups_test_groups values (C,3,''C''); + insert into groups_test_groups values (D,4,''D''); + insert into groups_test_groups values (E,5,''E''); + insert into groups_test_groups values (F,6,''F''); + insert into groups_test_groups values (G,7,''G''); + + -- Create the test members. + joe := acs_user__new(''joe@asdf.com'',''Joe'', + ''Smith'',''assword'',''p''); + jane := acs_user__new(''jane@asdf.com'',''Jane'', + ''Smith'',''assword'',''p''); + bob := acs_user__new(''bob@asdf.com'',''Bob'', + ''Smith'',''assword'',''p''); + betty := acs_user__new(''betty@asdf.com'',''Betty'', + ''Smith'',''assword'',''p''); + jack := acs_user__new(''jack@asdf.com'',''Jack'', + ''Smith'',''assword'',''p''); + jill := acs_user__new(''jill@asdf.com'',''Jill'', + ''Smith'',''assword'',''p''); + sven := acs_user__new(''sven@asdf.com'',''Sven'', + ''Smith'',''assword'',''p''); + stacy := acs_user__new(''stacy@asdf.com'',''Stacy'', + ''Smith'',''assword'',''p''); + + insert into groups_test_users values (joe,1,''joe''); + insert into groups_test_users values (jane,2,''jane''); + insert into groups_test_users values (bob,3,''bob''); + insert into groups_test_users values (betty,4,''betty''); + insert into groups_test_users values (jack,5,''jack''); + insert into groups_test_users values (jill,6,''jill''); + insert into groups_test_users values (sven,7,''sven''); + insert into groups_test_users values (stacy,8,''stacy''); + + -- Make a couple of compositions. + + reg_users := acs__magic_object_id(''registered_users''); + + rel_id := composition_rel__new(A, B); + rel_id := composition_rel__new(A, C); + rel_id := composition_rel__new(A, D); + + rel_id := composition_rel__new(E, A); + rel_id := composition_rel__new(E, F); + + rel_id := composition_rel__new(reg_users, E); + rel_id := composition_rel__new(reg_users, G); + -- define a few segments. + + -- define a few relational constraints. + + + side_two_constraint := rel_constraint__new( + null, + ''rel_constraint'', + ''Yippe: side 2 must be a blah of A'', + rel_segment__get_or_new(reg_users, + ''yippe_member_rel'', + null), + ''two'', + rel_segment__get_or_new(A, + ''blah_member_rel'', + null), + null, + null, + null + + ); + + + side_one_constraint := rel_constraint__new( + null, + ''rel_constraint'', + ''Yippe: side 1 must be a component of E'', + rel_segment__get_or_new(reg_users, + ''yippe_member_rel'', + null), + ''one'', + rel_segment__get_or_new(E, + ''composition_rel'', + null), + null, + null, + null + ); + + + delete from acs_logs; + + + -- Make a couple of memberships. + + -- LEGAL MEMBERSHIPS: + + -- textbook case: + -- joe is a blah of A, and F is component of E, so its legal to make joe + -- a yippe of F. + + rel_id := blah_member_rel__new(null, ''blah_member_rel'', A, joe); + + PERFORM rel_constraint_test_check(rel_id, ''f''); + + rel_id := yippe_member_rel__new(null, ''yippie_member_rel'', F, joe); + + PERFORM rel_constraint_test_check(rel_id, ''f''); + + -- do constraints respect group hierarchy? If so, this will be legal: + rel_id := blah_member_rel__new(null, ''blah_member_rel'', B, jane); + + PERFORM rel_constraint_test_check(rel_id, ''f''); + + rel_id := yippe_member_rel__new(null, ''yippie_member_rel'', F, jane); + + PERFORM rel_constraint_test_check(rel_id, ''f''); + + -- ILLEGAL MEMBERSHIPS: + + -- G is not a component of F, therefore no one can be a yippe of G + -- This should violated 2 constraints (object one and object two are both + -- invalid). + rel_id := yippe_member_rel__new(null, ''yippie_member_rel'', G, bob); + + PERFORM rel_constraint_test_check(rel_id, ''t''); + + -- betty is not a blah of A, therefore she cannot be a yippe of F. + rel_id := yippe_member_rel__new(null, ''yippie_member_rel'', F, betty); + + PERFORM rel_constraint_test_check(rel_id, ''t''); + + -- make sven be a regular member of A. Sven cannot be a yippe of F. + rel_id := membership_rel__new(A, sven); + rel_id := yippe_member_rel__new(null, ''yippie_member_rel'', F, sven); + + PERFORM rel_constraint_test_check(rel_id, ''t''); + + -- TEST THE VIEWS (there should be 4 violated constraints, + -- 1 side one violation and 3 side two violations. + + select count(*) into v_count + from rel_constraints_violated_one; + + if v_count != 1 then + raise NOTICE ''rel_constraints_violated_one should have 1 row. Found % rows.'', + v_count; + PERFORM rel_constraint_dump_views(); + end if; + + select count(*) into v_count + from rel_constraints_violated_two; + + if v_count != 3 then + raise NOTICE ''rel_constraints_violated_two should have 2 rows. Found % rows.'', + v_count; + PERFORM rel_constraint_dump_views(); + end if; + + + -- Remove the constraints + PERFORM rel_constraint__delete(side_one_constraint); + PERFORM rel_constraint__delete(side_two_constraint); + + -- Remove the test memebership relations + for r in select * from blah_member_rels LOOP + PERFORM blah_member_rel__delete(r.rel_id); + end loop; + + for r in select * from yippe_member_rels LOOP + PERFORM yippe_member_rel__delete(r.rel_id); + end loop; + + -- Remove the test segments. + PERFORM rel_segment__delete(rel_segment__get(A,''blah_member_rel'')); + PERFORM rel_segment__delete(rel_segment__get(E,''composition_rel'')); + PERFORM rel_segment__delete(rel_segment__get(reg_users,''yippe_member_rel'')); + + -- Remove the test groups. + PERFORM acs_group__delete(G); + PERFORM acs_group__delete(F); + PERFORM acs_group__delete(E); + PERFORM acs_group__delete(D); + PERFORM acs_group__delete(C); + PERFORM acs_group__delete(B); + PERFORM acs_group__delete(A); + + -- Remove the test members. + PERFORM acs_user__delete(joe); + PERFORM acs_user__delete(jane); + PERFORM acs_user__delete(bob); + PERFORM acs_user__delete(betty); + PERFORM acs_user__delete(jack); + PERFORM acs_user__delete(jill); + PERFORM acs_user__delete(sven); + PERFORM acs_user__delete(stacy); + + return null; + +end;' language 'plpgsql'; + + +select test_rel_constraints(); +drop function rel_constraint_dump_views(); +drop function rel_constraint_test_check (integer, boolean); +drop function test_rel_constraints(); +drop table groups_test_groups; +drop table groups_test_users; + +\i rel-segments-test-types-drop.sql + +select log_level, log_key, message +from acs_logs +where log_key = 'error'; Index: openacs-4/packages/acs-kernel/sql/postgresql/test/rel-segments-test-types-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/test/rel-segments-test-types-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-kernel/sql/postgresql/test/rel-segments-test-types-create.sql 22 Mar 2001 00:21:19 -0000 1.1 @@ -0,0 +1,205 @@ + +create function inline_0 () +returns integer as ' +begin + PERFORM acs_rel_type__create_type ( + ''blah_member_rel'', + ''Blah Membership Relationship'', + ''Blah Membership Relationships'', + ''membership_rel'', + ''blah_member_rels'', + ''rel_id'', + ''blah_member_rel'', + ''group'', + null, + 0, + null, + ''party'', + ''member'', + 0, + null + ); + + + PERFORM acs_rel_type__create_type ( + ''yippe_member_rel'', + ''Yippe Membership Relationship'', + ''Yippe Membership Relationships'', + ''membership_rel'', + ''yippe_member_rels'', + ''rel_id'', + ''yippe_member_rel'', + ''group'', + null, + 0, + null, + ''party'', + ''member'', + 0, + null + ); + + return null; + +end;' language 'plpgsql'; + +select inline_0 (); + +drop function inline_0 (); + + +-- show errors + +create table blah_member_rels ( + rel_id integer constraint blah_member_rel_id_fk + references membership_rels (rel_id) + constraint blah_member_rel_pk + primary key +); + +create table yippe_member_rels ( + rel_id integer constraint yippe_member_rel_id_fk + references membership_rels (rel_id) + constraint yippe_member_rel_pk + primary key +); + + +-- create or replace package blah_member_rel +-- is +-- function new ( +-- rel_id in blah_member_rels.rel_id%TYPE +-- default null, +-- rel_type in acs_rels.rel_type%TYPE +-- default 'blah_member_rel', +-- object_id_one in groups.group_id%TYPE, +-- object_id_two in parties.party_id%TYPE +-- ) return blah_member_rels.rel_id%TYPE; +-- +-- procedure delete ( +-- rel_id in blah_member_rels.rel_id%TYPE +-- ); +-- end blah_member_rel; + +-- show errors + +-- create or replace package body blah_member_rel +-- function new +create function blah_member_rel__new (integer,varchar,integer,integer) +returns integer as ' +declare + new__rel_id alias for $1; + new__rel_type alias for $2; + new__object_id_one alias for $3; + new__object_id_two alias for $4; + v_rel_id blah_member_rels.rel_id%TYPE; +begin + + v_rel_id := membership_rel__new( + new__rel_id, + new__rel_type, + new__object_id_one, + new__object_id_two, + ''approved'', + null, + null + ); + + insert into blah_member_rels + (rel_id) + values + (v_rel_id); + + return v_rel_id; + +end;' language 'plpgsql'; + + +-- procedure delete +create function blah_member_rel__delete (integer) +returns integer as ' +declare + delete__rel_id alias for $1; +begin + + delete from blah_member_rels where rel_id = delete__rel_id; + + PERFORM membership_rel__delete(delete__rel_id); + + return 0; +end;' language 'plpgsql'; + + + +-- show errors + + + +-- create or replace package yippe_member_rel +-- is +-- function new ( +-- rel_id in yippe_member_rels.rel_id%TYPE +-- default null, +-- rel_type in acs_rels.rel_type%TYPE +-- default 'yippe_member_rel', +-- object_id_one in groups.group_id%TYPE, +-- object_id_two in parties.party_id%TYPE +-- ) return yippe_member_rels.rel_id%TYPE; +-- +-- procedure delete ( +-- rel_id in yippe_member_rels.rel_id%TYPE +-- ); +-- end yippe_member_rel; + +-- show errors + +-- create or replace package body yippe_member_rel +-- function new +create function yippe_member_rel__new (integer,varchar,integer,integer) +returns integer as ' +declare + new__rel_id alias for $1; + new__rel_type alias for $2; + new__object_id_one alias for $3; + new__object_id_two alias for $4; + v_rel_id yippe_member_rels.rel_id%TYPE; +begin + + v_rel_id := membership_rel__new( + new__rel_id, + new__rel_type, + new__object_id_one, + new__object_id_two, + ''approved'', + null, + null + ); + + + insert into yippe_member_rels + (rel_id) + values + (v_rel_id); + + return v_rel_id; + +end;' language 'plpgsql'; + + +-- procedure delete +create function yippe_member_rel__delete (yippe_member_rels) +returns integer as ' +declare + delete__rel_id alias for $1; +begin + + delete from yippe_member_rels where rel_id = delete__rel_id; + + PERFORM membership_rel__delete(delete__rel_id); + + return 0; +end;' language 'plpgsql'; + + + +-- show errors Index: openacs-4/packages/acs-kernel/sql/postgresql/test/rel-segments-test-types-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/test/rel-segments-test-types-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-kernel/sql/postgresql/test/rel-segments-test-types-drop.sql 22 Mar 2001 00:21:19 -0000 1.1 @@ -0,0 +1,14 @@ + +select drop_package('blah_member_rel'); +select drop_package('yippe_member_rel'); + +drop table blah_member_rels; +drop table yippe_member_rels; + +begin; + + select acs_rel_type__drop_type('blah_member_rel','f'); + + select acs_rel_type__drop_type('yippe_member_rel','f'); + +end; Index: openacs-4/packages/acs-kernel/sql/postgresql/test/rel-segments-test.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/test/rel-segments-test.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-kernel/sql/postgresql/test/rel-segments-test.sql 22 Mar 2001 00:21:19 -0000 1.1 @@ -0,0 +1,377 @@ +-- +-- packages/acs-kernel/sql/test/rel-segments-test.sql +-- +-- @author oumi@arsdigita.com +-- @creation-date 2000-12-01 +-- @cvs-id rel-segments-test.sql,v 1.1.4.1 2001/01/12 23:06:33 oumi Exp +-- + +-- set serveroutput on + +create table groups_test_groups ( + group_id integer, + sorder integer, + gname varchar(100) +); + +create table groups_test_users ( + user_id integer, + sorder integer, + uname varchar(100) +); + +create table groups_test_segs ( + seg_id integer, + sorder integer, + sname varchar(100) +); + +-- creates blah_member_rel and yippe_member_rel relationships + +\i rel-segments-test-types-create.sql + + +create function rel_segment_test_check (integer, integer, integer) +returns boolean as ' +declare + test_check__segment_id alias for $1; + test_check__party_id alias for $2; + test_check__container_id alias for $3; + v_pass_p boolean; + str text; +begin + + select count(*) > 0 into v_pass_p + from rel_segment_party_map + where segment_id = test_check__segment_id + and party_id = test_check__party_id + and container_id = test_check__container_id; + + if NOT v_pass_p then + + str := ''Row missing from rel_segment_party_map for'' || + '' segment '''''' || acs_object.name(segment_id) || + '''''' ('' || segment_id || '')'' || + '', party '''''' || acs_object.name(party_id) || + '''''' ('' || party_id || '')'' || + '', container '''''' || acs_object.name(container_id) || + '''''' ('' ||container_id || '')''; + + raise NOTICE ''%'', str; + + acs_log.error(''rel_segment_test_check'', str); + end if; + + + return v_pass_p; + +end;' language 'plpgsql'; + + +create function test_segs() returns integer as ' +declare + A integer; + B integer; + C integer; + D integer; + E integer; + F integer; + G integer; + + joe integer; + jane integer; + bob integer; + betty integer; + jack integer; + jill integer; + sven integer; + stacy integer; + + seg_G_blahs integer; + seg_E_yippes integer; + + rel_id integer; +begin + -- Create the test groups. + + A := acs_group__new(''A''); + B := acs_group__new(''B''); + C := acs_group__new(''C''); + D := acs_group__new(''D''); + E := acs_group__new(''E''); + F := acs_group__new(''F''); + G := acs_group__new(''G''); + + insert into groups_test_groups values (A,1,''A''); + insert into groups_test_groups values (B,2,''B''); + insert into groups_test_groups values (C,3,''C''); + insert into groups_test_groups values (D,4,''D''); + insert into groups_test_groups values (E,5,''E''); + insert into groups_test_groups values (F,6,''F''); + insert into groups_test_groups values (G,7,''G''); + + -- Create the test members. + joe := acs_user__new(''joe@asdf.com'',''Joe'', + ''Smith'',''assword'',''p''); + jane := acs_user__new(''jane@asdf.com'',''Jane'', + ''Smith'',''assword'',''p''); + bob := acs_user__new(''bob@asdf.com'',''Bob'', + ''Smith'',''assword'',''p''); + betty := acs_user__new(''betty@asdf.com'',''Betty'', + ''Smith'',''assword'',''p''); + jack := acs_user__new(''jack@asdf.com'',''Jack'', + ''Smith'',''assword'',''p''); + jill := acs_user__new(''jill@asdf.com'',''Jill'', + ''Smith'',''assword'',''p''); + sven := acs_user__new(''sven@asdf.com'',''Sven'', + ''Smith'',''assword'',''p''); + stacy := acs_user__new(''stacy@asdf.com'',''Stacy'', + ''Smith'',''assword'',''p''); + + insert into groups_test_users values (joe,1,''joe''); + insert into groups_test_users values (jane,2,''jane''); + insert into groups_test_users values (bob,3,''bob''); + insert into groups_test_users values (betty,4,''betty''); + insert into groups_test_users values (jack,5,''jack''); + insert into groups_test_users values (jill,6,''jill''); + insert into groups_test_users values (sven,7,''sven''); + insert into groups_test_users values (stacy,8,''stacy''); + + -- Make a couple of compositions. + + rel_id := composition_rel__new(A, B); + rel_id := composition_rel__new(A, C); + rel_id := composition_rel__new(A, D); + + rel_id := composition_rel__new(E, A); + rel_id := composition_rel__new(F, A); + rel_id := composition_rel__new(G, A); + + -- Make a couple of memberships. + + rel_id := blah_member_rel__new(null, ''blah_member_rel'', B, joe); + rel_id := yippe_member_rel__new(null, ''yippie_member_rel'', B, jane); + rel_id := blah_member_rel__new(null, ''blah_member_rel'', B, betty); + rel_id := yippe_member_rel__new(null, ''yippie_member_rel'', A, bob); + rel_id := blah_member_rel__new(null, ''blah_member_rel'', A, betty); + rel_id := yippe_member_rel__new(null, ''yippie_member_rel'', E, betty); + + -- define a few segments. + + -- the segment of all parties that are blah members of G + seg_G_blahs := rel_segment__new(null, + ''rel_segment'', + now(), + null, + null, + null, + null, + ''Blahs of Group G'', + G, + ''blah_member_rel'', + null + ); + + -- the segment of all parties that are yippe members of E + seg_E_yippes := rel_segment__new(null, + ''rel_segment'', + now(), + null, + null, + null, + null, + ''Yippes of Group E'', + E, + ''yippe_member_rel'', + null + ); + + insert into groups_test_segs values (seg_G_blahs,1,''seg_G_blahs''); + insert into groups_test_segs values (seg_E_yippes,2,''seg_E_yippes''); + + delete from acs_logs; + + return null; + +end;' language 'plpgsql'; + +create function check_segs() returns integer as ' +declare + A integer; + B integer; + C integer; + D integer; + E integer; + F integer; + G integer; + + joe integer; + jane integer; + bob integer; + betty integer; + jack integer; + jill integer; + sven integer; + stacy integer; + + seg_G_blahs integer; + seg_E_yippes integer; + + rel_id integer; + r record; + str varchar; +begin + + select group_id into A from groups_test_groups where gname = ''A''; + select group_id into B from groups_test_groups where gname = ''B''; + select group_id into C from groups_test_groups where gname = ''C''; + select group_id into D from groups_test_groups where gname = ''D''; + select group_id into E from groups_test_groups where gname = ''E''; + select group_id into F from groups_test_groups where gname = ''F''; + select group_id into G from groups_test_groups where gname = ''G''; + + select user_id into joe from groups_test_users where gname = ''joe''; + select user_id into jane from groups_test_users where gname = ''jane''; + select user_id into bob from groups_test_users where gname = ''bob''; + select user_id into betty from groups_test_users where gname = ''betty''; + select user_id into jack from groups_test_users where gname = ''jack''; + select user_id into jill from groups_test_users where gname = ''jill''; + select user_id into sven from groups_test_users where gname = ''sven''; + select user_id into stacy from groups_test_users where gname = ''stacy''; + + select seg_id into seg_G_blahs + from groups_test_segs + where sname = ''seg_G_blahs''; + + select seg_id into seg_E_yippes + from groups_test_segs + where sname = ''seg_G_blahs''; + +-- group_element_index_dump; +-- rel_segment_party_map_dump; + + + -- Expectations: + -- 1. seg_G_blahs should include joe and betty + -- 2. seg_E_yippes should include bob, and jane, betty + + -- check: seg_G_blahs contains joe with container B + if rel_segment_test_check(seg_G_blahs, joe, B) = ''f'' then + str := ''Segment '' || acs_object__name(seg_G_blahs) || + ''('' || seg_G_blahs || '') failed. Group_id = '' + || G; + raise NOTICE ''%'', str; + end if; + + -- check: seg_G_blahs contains betty with container B + if rel_segment_test_check(seg_G_blahs, betty, B) = ''f'' then + str := ''Segment '' || acs_object__name(seg_G_blahs) || + ''('' || seg_G_blahs || '') failed. Group_id = '' + || G; + raise NOTICE ''%'', str; + end if; + + -- check: seg_G_blahs contains betty with container A + if rel_segment_test_check(seg_G_blahs, betty, A) = ''f'' then + str := ''Segment '' || acs_object__name(seg_G_blahs) || + ''('' || seg_G_blahs || '') failed. Group_id = '' + || G; + raise NOTICE ''%'', str; + end if; + + -- check: seg_E_yippes contains jane with container B + if rel_segment_test_check(seg_E_yippes, jane, B) = ''f'' then + str := ''Segment '' || acs_object__name(seg_E_yippes) || + ''('' || seg_E_yippes || '') failed. Group_id = '' + || E; + raise NOTICE ''%'', str; + end if; + + -- check: seg_E_yippes contains bob with container A + if rel_segment_test_check(seg_E_yippes, bob, A) = ''f'' then + str := ''Segment '' || acs_object__name(seg_E_yippes) || + ''('' || seg_E_yippes || '') failed. Group_id = '' + || E; + raise NOTICE ''%'', str; + end if; + + -- check: seg_E_yippes contains betty with container E + if rel_segment_test_check(seg_E_yippes, betty, E) = ''f'' then + str := ''Segment '' || acs_object__name(seg_E_yippes) || + ''('' || seg_E_yippes || '') failed. Group_id = '' + || E; + raise NOTICE ''%'', str; + end if; + + -- Now we test on-the-fly creation of rel-segments with the get_or_new + -- function: + + -- The segment of all memers of F should contain jane through group B + if rel_segment_test_check( + rel_segment__get_or_new(F,''membership_rel''), jane, B) = ''f'' then + str := ''Segment '' || + acs_object__name(rel_segment__get(F,''membership_rel'')) || + ''('' || rel_segment__get(F,''membership_rel'') + || '') failed. Group_id = '' || F; + raise NOTICE ''%'', str; + end if; + + -- The segment of all memers of F should contain betty through group A + if rel_segment_test_check( + rel_segment__get_or_new(F,''membership_rel''), betty, A) = ''f'' then + str := ''Segment '' || + acs_object__name(rel_segment__get(F,''membership_rel'')) || + ''('' || rel_segment__get(F,''membership_rel'') + || '') failed. Group_id = '' || A; + raise NOTICE ''%'', str; + end if; + + -- Remove the test segments. + PERFORM rel_segment__delete(seg_G_blahs); + PERFORM rel_segment__delete(seg_E_yippes); + PERFORM rel_segment__delete(rel_segment__get(F,''membership_rel'')); + + -- Remove the test memebership relations + for r in select * from blah_member_rels LOOP + PERFORM blah_member_rel__delete(r.rel_id); + end loop; + + for r in select * from yippe_member_rels LOOP + PERFORM yippe_member_rel__delete(r.rel_id); + end loop; + + -- Remove the test groups. + PERFORM acs_group__delete(G); + PERFORM acs_group__delete(F); + PERFORM acs_group__delete(E); + PERFORM acs_group__delete(D); + PERFORM acs_group__delete(C); + PERFORM acs_group__delete(B); + PERFORM acs_group__delete(A); + + -- Remove the test members. + PERFROM acs_user__delete(joe); + PERFROM acs_user__delete(jane); + PERFROM acs_user__delete(bob); + PERFROM acs_user__delete(betty); + PERFROM acs_user__delete(jack); + PERFROM acs_user__delete(jill); + PERFROM acs_user__delete(sven); + PERFROM acs_user__delete(stacy); + + return null; + +end;' language 'plpgsql'; + +select test_segs(); +select check_segs(); + +drop function rel_segment_test_check(integer, integer, integer); +drop function test_segs(); +drop function check_segs(); + +\i rel-segments-test-types-drop.sql + +select log_level, log_key, message +from acs_logs +where log_level = 'error'; Index: openacs-4/packages/acs-kernel/sql/postgresql/test-harness/acs-core.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/test-harness/acs-core.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-kernel/sql/postgresql/test-harness/acs-core.sql 22 Mar 2001 00:21:19 -0000 1.1 @@ -0,0 +1,79 @@ +-- +-- acs-core/sql/acs-core-test-harness.sql +-- +-- Test harness for ACS Core's PL/SQL API +-- +-- @author Michael Yoon (michael@arsdigita.com) +-- +-- @creation-date 2000-08-05 +-- +-- @cvs-id $Id: acs-core.sql,v 1.1 2001/03/22 00:21:19 danw Exp $ +-- + +create function test_acs_core () returns integer as ' +declare + uid users.user_id%TYPE; + tname varchar; +begin + raise notice ''Calling acs_user.new() to create user 1''; + + uid := + acs_user__new(1, + ''user'', + now(), + null, + ''127.0.0.1'', + ''jane.doe@arsdigita.com'', + null, + ''Jane'', + ''Doe'', + ''janedoerules'', + null, + null, + null, + null, + ''t'', + null + ); + + + tname := acs_object__name(1); + + raise NOTICE ''Calling acs_object.name to get the name of user: %'', tname; + + raise NOTICE ''Calling acs_user.delete to delete user 1''; + + -- PERFORM acs_user__delete(1); + + return NULL; + +end;' language 'plpgsql'; + +create function test_del_user () returns integer as ' +declare +begin + perform acs_user__delete(1); + + return null; + +end;' language 'plpgsql'; + +begin; +select test_acs_core (); +select test_del_user (); +end; +drop function test_acs_core (); +drop function test_del_user (); + + +-- select acs_user__delete(1); + +/* +delete from user_preferences +where user_id = 1; + +delete from users +where user_id = 1; + +select person__delete(1); +*/ Index: openacs-4/packages/acs-kernel/sql/postgresql/test-harness/acs-permissions.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/test-harness/acs-permissions.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-kernel/sql/postgresql/test-harness/acs-permissions.sql 22 Mar 2001 00:21:19 -0000 1.1 @@ -0,0 +1,250 @@ +-- file: packages/acs-kernel/sql/acs-permissions-test.sql +-- history: date email message +-- 2000-08-10 rhs@mit.edu initial version + +begin; + -- Objects for testing. + insert into acs_object_types + (object_type, supertype, pretty_name, pretty_plural) + values + ('bboard', 'acs_object', 'BBoard', 'BBoards'); + + insert into acs_object_types + (object_type, supertype, pretty_name, pretty_plural) + values + ('bboard_message', 'acs_object', 'BBoard Message', 'BBoard Messages'); + + -------------------------------------------------------------- + -- Some privileges that will be fundamental to all objects. -- + -------------------------------------------------------------- + + insert into acs_privileges + (privilege) + values + ('read'); + + insert into acs_privileges + (privilege) + values + ('write'); + + insert into acs_privileges + (privilege) + values + ('create'); + + insert into acs_privileges + (privilege) + values + ('delete'); + + insert into acs_privileges + (privilege) + values + ('admin'); + + insert into acs_privileges + (privilege) + values + ('all'); + + ---------------------------------------------------------- + -- Some privileges that probably only apply to bboards. -- + ---------------------------------------------------------- + + insert into acs_privileges + (privilege) + values + ('moderate'); + + ------------------------------------------------- + -- Administrators can read, write, and create. -- + ------------------------------------------------- + + insert into acs_privilege_hierarchy + (privilege, child_privilege) + values + ('admin', 'read'); + + insert into acs_privilege_hierarchy + (privilege, child_privilege) + values + ('admin', 'write'); + + insert into acs_privilege_hierarchy + (privilege, child_privilege) + values + ('admin', 'create'); + + insert into acs_privilege_hierarchy + (privilege, child_privilege) + values + ('admin', 'delete'); + + ------------------------------------ + -- Moderators can read and write. -- + ------------------------------------ + + insert into acs_privilege_hierarchy + (privilege, child_privilege) + values + ('moderate', 'read'); + + insert into acs_privilege_hierarchy + (privilege, child_privilege) + values + ('moderate', 'write'); + + insert into acs_privilege_hierarchy + (privilege, child_privilege) + values + ('all', 'admin'); + + insert into acs_privilege_hierarchy + (privilege, child_privilege) + values + ('all', 'moderate'); + + ------------------------ + -- Methods on bboards -- + ------------------------ + + insert into acs_methods + (object_type, method) + values + ('bboard', 'select_any_message'); + + insert into acs_methods + (object_type, method) + values + ('bboard', 'update_any_message'); + + insert into acs_methods + (object_type, method) + values + ('bboard', 'delete_any_message'); + + insert into acs_methods + (object_type, method) + values + ('bboard', 'insert_bboard'); + + insert into acs_methods + (object_type, method) + values + ('bboard', 'update_bboard'); + + insert into acs_methods + (object_type, method) + values + ('bboard', 'select_bboard'); + + insert into acs_methods + (object_type, method) + values + ('bboard', 'delete_bboard'); + + --------------------------------- + -- Methods on bboard messages. -- + --------------------------------- + + insert into acs_methods + (object_type, method) + values + ('bboard_message', 'select_message'); + + insert into acs_methods + (object_type, method) + values + ('bboard_message', 'update_message'); + + insert into acs_methods + (object_type, method) + values + ('bboard_message', 'insert_message'); + + insert into acs_methods + (object_type, method) + values + ('bboard_message', 'delete_message'); + + insert into acs_methods + (object_type, method) + values + ('bboard_message', 'foo'); + + ------------------------------------------------------------------------- + -- Mappings between privileges and methods on particular object types. -- + ------------------------------------------------------------------------- + + + -- Methods that correspond to read for a bboard + insert into acs_privilege_method_rules + (privilege, object_type, method) + values + ('read', 'bboard', 'select_any_message'); + + insert into acs_privilege_method_rules + (privilege, object_type, method) + values + ('read', 'bboard', 'select_bboard'); + + -- Methods that correspond to read for a bboard message. + insert into acs_privilege_method_rules + (privilege, object_type, method) + values + ('read', 'bboard_message', 'select_message'); + + -- Methods that correspond to write for a bboard. + insert into acs_privilege_method_rules + (privilege, object_type, method) + values + ('write', 'bboard', 'update_bboard'); + + insert into acs_privilege_method_rules + (privilege, object_type, method) + values + ('write', 'bboard', 'update_any_message'); + + -- Methods that correspond to write for a bboard message. + insert into acs_privilege_method_rules + (privilege, object_type, method) + values + ('write', 'bboard_message', 'update_message'); + + -- Methods that correspond to create for a bboard. + insert into acs_privilege_method_rules + (privilege, object_type, method) + values + ('create', 'bboard', 'insert_bboard'); + + -- Methods that correspond to create for a bboard message. + insert into acs_privilege_method_rules + (privilege, object_type, method) + values + ('create', 'bboard_message', 'insert_message'); + + -- Methods that correspond to delete for a bboard. + insert into acs_privilege_method_rules + (privilege, object_type, method) + values + ('delete', 'bboard', 'delete_bboard'); + + -- Methods that correspond to delete for a bboard. + insert into acs_privilege_method_rules + (privilege, object_type, method) + values + ('delete', 'bboard', 'delete_any_message'); + + -- Methods that correspond to create for a bboard message. + insert into acs_privilege_method_rules + (privilege, object_type, method) + values + ('delete', 'bboard_message', 'delete_message'); + + insert into acs_privilege_method_rules + (privilege, object_type, method) + values + ('all', 'bboard_message', 'foo'); + +commit;