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.3 -r1.3.6.1
--- openacs-4/packages/dotlrn/sql/postgresql/custom-permissions.sql	1 Nov 2013 21:08:29 -0000	1.3
+++ openacs-4/packages/dotlrn/sql/postgresql/custom-permissions.sql	8 Oct 2022 20:07:17 -0000	1.3.6.1
@@ -22,50 +22,51 @@
 -- If you customize the dotLRN community datamodel and violate any of the
 -- above assumptions, rewrite this function.
 
+-- This function is nowhere called, so deactivate this for now, but
+-- keep it for documentation purposes. The handling of direct
+-- permissions should be done via permission::permission_p, the
+-- handling of the relsegments should be doable over this as well.
+--
+-- select define_function_args('dotlrn_community_admin_p','group_id,party_id');
 
-
-
--- 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;
+-- 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;
