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 -N --- openacs-4/packages/dotlrn/sql/postgresql/custom-permissions.sql 1 Nov 2013 21:08:29 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,71 +0,0 @@ --- @author Don Baccus --- @creation-date 2002-07-09 --- --- Ported from oracle 2002-08-10 davis@xarg.net --- --- Return 't' if the party has admin privileges on the given group --- This function is much faster than the general permissions permission_p --- function as it takes advantage of the fact that we know the object --- being checked is a group. This allows us to greatly simplify the relseg --- check. - --- We also don't bother checking to see if "The Public" (all visitors) or --- "Registered Users" are allowed to admin the dotLRN community because, well, --- we know they aren't. - - --- We also don't check to see if the group has the direct admin perm on --- the object because dotLRN puts all group-level admins into a relational --- segment with the 'admin' privilege on its parent group. - - --- If you customize the dotLRN community datamodel and violate any of the --- above assumptions, rewrite this function. - - - - --- 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') - then - return 't'; - end if; - - -- check to see if the user belongs to a rel seg that has - -- the admin priv on the object (in this case a group) - - - if exists ( - select 1 - from acs_object_grantee_priv_map ogpm, - 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.grantee_id = rs.segment_id - and rs.member_id = p_party_id) - then - return 't'; - end if; - - return 'f'; -END; -$$ LANGUAGE plpgsql; Index: openacs-4/packages/dotlrn/tcl/community-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs.tcl,v diff -u -N -r1.211.2.3 -r1.211.2.4 --- openacs-4/packages/dotlrn/tcl/community-procs.tcl 2 Jan 2016 21:58:25 -0000 1.211.2.3 +++ openacs-4/packages/dotlrn/tcl/community-procs.tcl 29 Jul 2016 13:20:14 -0000 1.211.2.4 @@ -1038,14 +1038,17 @@ @return community_id of the community where the package is mounted, empty string if not found } { if {$package_id eq ""} { - set package_id [site_node::closest_ancestor_package -include_self -package_key dotlrn] + set package_id [site_node::closest_ancestor_package \ + -url [ad_conn url] \ + -include_self \ + -package_key dotlrn] if {$package_id eq ""} { set package_id [ad_conn package_id] } } if {$package_id ne ""} { - return [util_memoize "dotlrn_community::get_community_id_not_cached -package_id $package_id"] + return [util_memoize [list dotlrn_community::get_community_id_not_cached -package_id $package_id]] } else { return "" } @@ -1151,7 +1154,7 @@ } if {$complain_if_invalid_p && !$valid_p} { - ns_log notice "The name $community_key is already in use either by an active or archived group. \n Please go back and select a different name." + ns_log notice "The name '$community_key' is already in use either by an active or archived group. \n Please go back and select a different name." ad_return_complaint 1 \ [_ dotlrn.community_name_already_in_use [list community_key $community_key]]