Index: openacs-4/packages/directory/sql/postgresql/directory-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/directory/sql/postgresql/directory-create.sql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/directory/sql/postgresql/directory-create.sql	21 Oct 2001 18:16:34 -0000	1.1
+++ openacs-4/packages/directory/sql/postgresql/directory-create.sql	3 Oct 2003 06:41:19 -0000	1.2
@@ -9,11 +9,10 @@
 -- call this view using "and group_id = :application_group_id"
 -- to find all members of an application_group
 create view dir_group_members as
-   select p.party_id as user_id, p.email, pe.first_names, pe.last_name, p.url, r.object_id_one as group_id
-     from parties p, persons pe, acs_rels r
+   select p.party_id as user_id, p.email, pe.first_names, pe.last_name, p.url, gem.group_id
+     from parties p, persons pe, group_approved_member_map gem
     where p.party_id = pe.person_id
-      and p.party_id = r.object_id_two
-      and r.rel_type = 'membership_rel';
+      and p.party_id = gem.member_id;
 
 -- call this view using "and subsite_id = :subsite_id"
 -- to find all members of a subsite
@@ -26,8 +25,8 @@
 -- view to display all registered users 
 -- (the ACS registered_users view is slower, and retrieves a lot of information that we don't need)
 create view dir_all_users as
-   select p.party_id as user_id, p.email, pe.first_names, pe.last_name, p.url
-     from parties p, persons pe
-    where p.party_id = pe.person_id;
+   select distinct p.party_id as user_id, p.email, pe.first_names, pe.last_name, p.url
+     from parties p, persons pe, group_approved_member_map gem
+    where p.party_id = pe.person_id and gem.member_id = p.party_id;
 
 
