Index: openacs-4/packages/dotlrn/sql/postgresql/custom-permissions.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/custom-permissions.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/postgresql/custom-permissions.sql 4 Dec 2002 09:51:03 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/postgresql/custom-permissions.sql 1 Nov 2013 21:08:29 -0000 1.3 @@ -23,22 +23,30 @@ -- above assumptions, rewrite this function. -create or replace function dotlrn_community_admin_p (integer, integer) -returns char as ' - declare - p_group_id alias for $1; - p_party_id alias for $2; - begin + + +-- added +select define_function_args('dotlrn_community_admin_p','group_id,party_id'); + +-- +-- procedure dotlrn_community_admin_p/2 +-- +CREATE OR REPLACE FUNCTION dotlrn_community_admin_p( + p_group_id integer, + p_party_id integer +) RETURNS char AS $$ +DECLARE + BEGIN -- -- direct permissions if exists ( select 1 from acs_object_grantee_priv_map where object_id = p_group_id and grantee_id = p_party_id - and privilege = ''admin'') + and privilege = 'admin') then - return ''t''; + return 't'; end if; -- check to see if the user belongs to a rel seg that has @@ -51,12 +59,13 @@ rel_seg_approved_member_map rs where rs.group_id = p_group_id and ogpm.object_id = rs.group_id - and ogpm.privilege = ''admin'' + and ogpm.privilege = 'admin' and ogpm.grantee_id = rs.segment_id and rs.member_id = p_party_id) then - return ''t''; + return 't'; end if; - return ''f''; -end;' language 'plpgsql'; + return 'f'; +END; +$$ LANGUAGE plpgsql;