Index: openacs-4/packages/acs-kernel/sql/oracle/groups-body-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/groups-body-create.sql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/acs-kernel/sql/oracle/groups-body-create.sql	11 Aug 2001 21:31:03 -0000	1.2
+++ openacs-4/packages/acs-kernel/sql/oracle/groups-body-create.sql	23 Feb 2002 02:43:45 -0000	1.3
@@ -698,13 +698,41 @@
  end name;
 
  function member_p (
-  party_id      in parties.party_id%TYPE
+  party_id      in parties.party_id%TYPE,
+  group_id	in groups.group_id%TYPE,
+  cascade_membership char
  )
  return char
  is
+ m_result integer;
  begin
-  -- TO DO: implement this for real
-  return 't';
+
+  if cascade_membership = 't' then
+    select count(*)
+      into m_result
+      from group_member_map
+      where group_id = member_p.group_id and
+            member_id = member_p.party_id;
+
+    if m_result > 0 then
+      return 't';
+    end if;
+  else
+    select count(*)
+      into m_result
+      from acs_rels rels, all_object_party_privilege_map perm
+    where perm.object_id = rels.rel_id
+           and perm.privilege = 'read'
+           and rels.rel_type = 'membership_rel'
+	   and rels.object_id_one = member_p.group_id
+           and rels.object_id_two = member_p.party_id;
+
+    if m_result > 0 then
+      return 't';
+    end if;
+  end if;
+
+  return 'f';
  end member_p;
 
  function check_representation (
