Index: openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs-oracle.xql,v diff -u -r1.4 -r1.5 --- openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs-oracle.xql 31 Oct 2001 20:42:07 -0000 1.4 +++ openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs-oracle.xql 28 Nov 2001 18:39:39 -0000 1.5 @@ -457,7 +457,7 @@ start with message_id = :message_id connect by message_id = prior reply_to) and s.subscriber_id in (select party_id - from acs_object_party_privilege_map + from all_object_party_privilege_map where object_id = :message_id and privilege = 'bboard_read_message') Index: openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs-postgresql.xql,v diff -u -r1.5 -r1.6 --- openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs-postgresql.xql 1 Nov 2001 19:01:47 -0000 1.5 +++ openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs-postgresql.xql 28 Nov 2001 18:39:39 -0000 1.6 @@ -419,10 +419,11 @@ (select substring(tree_sortkey from 0 for 4) || '%' from acs_messages where message_id = :message_id)) - and s.subscriber_id in (select party_id - from acs_object_party_privilege_map - where object_id = :message_id - and privilege = 'bboard_read_message') + and exists (select 1 + from all_object_party_privilege_map map + where map.object_id = :message_id and + map.party_id = s.subscriber_id and + privilege = 'bboard_read_message') @@ -435,10 +436,12 @@ from bboard_category_subscribers s, bboard_category_message_map m where m.message_id = :message_id and s.category_id = m.category_id - and s.subscriber_id in (select party_id - from acs_object_party_privilege_map - where object_id = :message_id - and privilege = 'bboard_read_message') + and exists (select 1 + from all_object_party_privilege_map map + where map.object_id = :message_id and + map.party_id = s.subscriber_id and + privilege = 'bboard_read_message') + @@ -450,10 +453,11 @@ from bboard_forum_subscribers s, bboard_forum_message_map m where m.message_id = :message_id and s.forum_id = m.forum_id - and s.subscriber_id in (select party_id - from acs_object_party_privilege_map - where object_id = :message_id - and privilege = 'bboard_read_message') + and exists (select 1 + from all_object_party_privilege_map map + where map.object_id = :message_id and + map.party_id = s.subscriber_id and + privilege = 'bboard_read_message') Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-move.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-move.xql,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/obsolete-packages/bboard/www/forum-move.xql 29 Jun 2001 20:37:18 -0000 1.1 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-move.xql 28 Nov 2001 18:39:39 -0000 1.2 @@ -17,7 +17,7 @@ select forum_id, short_name from bboard_forums where not forum_id = :forum_id - and exists (select 1 from acs_object_party_privilege_map + and exists (select 1 from all_object_party_privilege_map where object_id = forum_id and party_id in (:user_id, -1) and privilege = 'admin') Index: openacs-4/contrib/obsolete-packages/bboard/www/message-delete-2-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-delete-2-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/obsolete-packages/bboard/www/message-delete-2-oracle.xql 29 Jun 2001 20:37:18 -0000 1.1 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-delete-2-oracle.xql 28 Nov 2001 18:39:39 -0000 1.2 @@ -11,7 +11,7 @@ from acs_messages m connect by prior message_id = reply_to start with message_id = :message_id) - and exists (select 1 from acs_object_party_privilege_map + and exists (select 1 from all_object_party_privilege_map where object_id = bfm.message_id and party_id in (:user_id, -1) and privilege = 'bboard_delete_message') Index: openacs-4/contrib/obsolete-packages/bboard/www/message-move.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-move.xql,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/obsolete-packages/bboard/www/message-move.xql 29 Jun 2001 20:37:18 -0000 1.1 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-move.xql 28 Nov 2001 18:39:39 -0000 1.2 @@ -20,9 +20,9 @@ select forum_id, short_name from bboard_forums where not forum_id = :forum_id - and exists (select 1 from acs_object_party_privilege_map + and exists (select 1 from all_object_party_privilege_map where object_id = forum_id - and party_id in (:user_id, -1) + and party_id in :user_id and privilege = 'admin') Index: openacs-4/contrib/obsolete-packages/bboard/www/messages-by-user.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/messages-by-user.xql,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/obsolete-packages/bboard/www/messages-by-user.xql 29 Jun 2001 20:37:18 -0000 1.1 +++ openacs-4/contrib/obsolete-packages/bboard/www/messages-by-user.xql 28 Nov 2001 18:39:39 -0000 1.2 @@ -61,9 +61,9 @@ from bboard_messages_all bma where sender = :user_id and bma.forum_id = bf.forum_id) - and exists (select 1 from acs_object_party_privilege_map + and exists (select 1 from all_object_party_privilege_map where object_id = bf.forum_id - and party_id in (:current_user_id, -1) + and party_id in :current_user_id and privilege = 'bboard_read_forum') Index: openacs-4/packages/acs-kernel/sql/postgresql/acs-permissions-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/acs-permissions-create.sql,v diff -u -r1.16 -r1.17 --- openacs-4/packages/acs-kernel/sql/postgresql/acs-permissions-create.sql 15 Nov 2001 01:47:13 -0000 1.16 +++ openacs-4/packages/acs-kernel/sql/postgresql/acs-permissions-create.sql 28 Nov 2001 18:39:39 -0000 1.17 @@ -436,6 +436,8 @@ -- where oppm.object_id = my_table.my_id; -- +-- DRB: This view does seem to be quite fast in Postgres as well as Oracle. + create view all_object_party_privilege_map as select op.object_id, pdm.descendant as privilege, @@ -526,8 +528,9 @@ return 0; end;' language 'plpgsql'; - -- Speedy version of permission_p from Matthew Avalos +-- Further improved to a minor degree by Don Baccus + create function acs_permission__permission_p (integer,integer,varchar) returns boolean as ' declare @@ -537,73 +540,112 @@ exists_p boolean; begin -- + -- Check public-like permissions + if (0 = permission_p__party_id or + exists (select 1 from users where user_id = permission_p__party_id)) and + exists (select 1 + from acs_object_grantee_priv_map + where object_id = permission_p__object_id + and privilege = permission_p__privilege + and grantee_id = -1) + -- + then + return ''t''; + end if; + -- + -- Check direct permissions + if exists ( + select 1 + from acs_object_grantee_priv_map + where object_id = permission_p__object_id + and grantee_id = permission_p__party_id + and privilege = permission_p__privilege) + then + return ''t''; + end if; + -- -- Check group permmissions - select 1 into exists_p - where exists ( + if exists ( select 1 from acs_object_grantee_priv_map ogpm, group_approved_member_map gmm where object_id = permission_p__object_id and gmm.member_id = permission_p__party_id and privilege = permission_p__privilege - and ogpm.grantee_id = gmm.group_id); - if FOUND then + and ogpm.grantee_id = gmm.group_id) + then return ''t''; end if; -- -- relational segment approved group - select 1 into exists_p - where exists ( + if exists ( select 1 from acs_object_grantee_priv_map ogpm, rel_seg_approved_member_map rsmm where object_id = permission_p__object_id and rsmm.member_id = permission_p__party_id and privilege = permission_p__privilege - and ogpm.grantee_id = rsmm.segment_id); - if FOUND then + and ogpm.grantee_id = rsmm.segment_id) + then return ''t''; end if; + return ''f''; +end;' language 'plpgsql'; + +-- Returns true if at least one user exists with the given permission. Used +-- to avoid some queries on acs_object_party_privilege_map. + +create function acs_permission__user_with_perm_exists_p (integer,varchar) +returns boolean as ' +declare + permission_p__object_id alias for $1; + permission_p__privilege alias for $2; +begin -- - -- Check direct permissions - select 1 into exists_p - where exists ( + -- Check public-like permissions + if exists (select 1 + from acs_object_grantee_priv_map + where object_id = permission_p__object_id + and privilege = permission_p__privilege + and grantee_id = -1) + -- + then + return ''t''; + end if; + -- + -- Check direct user permissions + if exists ( select 1 - from acs_object_grantee_priv_map + from acs_object_grantee_priv_map, users where object_id = permission_p__object_id - and grantee_id = permission_p__party_id - and privilege = permission_p__privilege); - if FOUND then + and grantee_id = user_id + and privilege = permission_p__privilege) + then return ''t''; end if; -- - -- Check public permissions - select 1 into exists_p - where exists ( - select 1 - from acs_object_grantee_priv_map m, users u + -- Check group permmissions + if exists ( + select 1 + from acs_object_grantee_priv_map ogpm, + group_approved_member_map gmm where object_id = permission_p__object_id - and u.user_id = permission_p__party_id and privilege = permission_p__privilege - and m.grantee_id = -1); - if FOUND then + and ogpm.grantee_id = gmm.group_id) + then return ''t''; end if; -- - -- Check public-like permissions - select 1 into exists_p - where exists ( + -- relational segment approved group + if exists ( select 1 - from acs_object_grantee_priv_map + from acs_object_grantee_priv_map ogpm, + rel_seg_approved_member_map rsmm where object_id = permission_p__object_id - and 0 = permission_p__party_id and privilege = permission_p__privilege - and grantee_id = -1); - -- - if FOUND then - return ''t''; - else - return ''f''; + and ogpm.grantee_id = rsmm.segment_id) + then + return ''t''; end if; + return ''f''; end;' language 'plpgsql'; - Index: openacs-4/packages/acs-subsite/www/admin/group-types/delete-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/group-types/Attic/delete-2.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-subsite/www/admin/group-types/delete-2.xql 20 Aug 2001 21:52:31 -0000 1.2 +++ openacs-4/packages/acs-subsite/www/admin/group-types/delete-2.xql 28 Nov 2001 18:39:39 -0000 1.3 @@ -15,8 +15,8 @@ - select o.object_id - from acs_objects o, acs_object_party_privilege_map perm + select distinct o.object_id + from acs_objects o, all_object_party_privilege_map perm where perm.object_id = o.object_id and perm.party_id = :user_id and perm.privilege = 'delete' Index: openacs-4/packages/acs-subsite/www/admin/group-types/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/group-types/Attic/index-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/admin/group-types/index-postgresql.xql 15 May 2001 16:59:00 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/admin/group-types/index-postgresql.xql 28 Nov 2001 18:39:39 -0000 1.2 @@ -18,11 +18,8 @@ left outer join (select o.object_type, count(*) as number_groups from groups g, acs_objects o, - acs_object_party_privilege_map perm, application_group_element_map app_group - where perm.object_id = g.group_id - and perm.party_id = :user_id - and perm.privilege = 'read' + where acs_permission__permission_p(g.group_id, :user_id, 'read') and o.object_id = g.group_id and app_group.package_id = :package_id and app_group.element_id = g.group_id Index: openacs-4/packages/acs-subsite/www/admin/rel-segments/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/rel-segments/index-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/admin/rel-segments/index-postgresql.xql 15 May 2001 16:59:00 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/admin/rel-segments/index-postgresql.xql 28 Nov 2001 18:39:39 -0000 1.2 @@ -10,11 +10,8 @@ s.rel_type, t.pretty_name as rel_type_pretty_name from acs_object_types t, rel_segments s, - acs_object_party_privilege_map perm, application_group_segments ags - where perm.object_id = s.segment_id - and perm.party_id = :user_id - and perm.privilege = 'read' + where acs_permission__permission_p(s.segment_id, :user_id, 'read') and t.object_type = s.rel_type and s.segment_id = ags.segment_id and ags.package_id = :package_id Index: openacs-4/packages/acs-subsite/www/admin/rel-segments/one-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/rel-segments/Attic/one-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/admin/rel-segments/one-postgresql.xql 15 May 2001 16:59:00 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/admin/rel-segments/one-postgresql.xql 28 Nov 2001 18:39:39 -0000 1.2 @@ -2,7 +2,19 @@ postgresql7.1 + + + + + select count(*) as number_elements + from rel_segment_party_map map + where acs_permission__permission_p(map.party_id, :user_id, 'read') + and map.segment_id = :segment_id + + + + Index: openacs-4/packages/acs-subsite/www/admin/rel-types/delete-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/rel-types/delete-2-postgresql.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-subsite/www/admin/rel-types/delete-2-postgresql.xql 20 Aug 2001 05:15:29 -0000 1.3 +++ openacs-4/packages/acs-subsite/www/admin/rel-types/delete-2-postgresql.xql 28 Nov 2001 18:39:39 -0000 1.4 @@ -17,4 +17,28 @@ + + + + select r.rel_id + from acs_rels r + where acs_permission__permission_p(r.rel_id, :user_id, 'delete') + and r.rel_type = :rel_type + + + + + + + + + select s.segment_id + from rel_segments s + where acs_permission__permission_p(s.segment_id, :user_id, 'delete') + and s.rel_type = :rel_type + + + + + Index: openacs-4/packages/acs-subsite/www/admin/rel-types/one-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/rel-types/Attic/one-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-subsite/www/admin/rel-types/one-postgresql.xql 11 Aug 2001 21:31:03 -0000 1.2 +++ openacs-4/packages/acs-subsite/www/admin/rel-types/one-postgresql.xql 28 Nov 2001 18:39:39 -0000 1.3 @@ -26,11 +26,8 @@ select v_inner.* from (select r.rel_id, acs_object__name(r.object_id_one) || ' and ' || acs_object__name(r.object_id_two) as name - from acs_rels r, acs_object_party_privilege_map perm, - app_group_distinct_rel_map m - where perm.object_id = r.rel_id - and perm.party_id = :user_id - and perm.privilege = 'read' + from acs_rels r, app_group_distinct_rel_map m + where acs_permission__permission_p(r.rel_id, :user_id, 'read') and r.rel_type = :rel_type and m.rel_id = r.rel_id and m.package_id = :package_id Index: openacs-4/packages/acs-subsite/www/admin/rel-types/rels-list-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/rel-types/Attic/rels-list-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/admin/rel-types/rels-list-postgresql.xql 15 May 2001 16:59:01 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/admin/rel-types/rels-list-postgresql.xql 28 Nov 2001 18:39:39 -0000 1.2 @@ -7,11 +7,8 @@ select r.rel_id, acs_object__name(r.object_id_one) || ' and ' || acs_object__name(r.object_id_two) as name - from acs_rels r, acs_object_party_privilege_map perm, - app_group_distinct_rel_map m - where perm.object_id = r.rel_id - and perm.party_id = :user_id - and perm.privilege = 'read' + from acs_rels r, app_group_distinct_rel_map m + where acs_permission__permission_p(r.rel_id, :user_id, 'read') and r.rel_type = :rel_type and m.rel_id = r.rel_id and m.package_id = :package_id Index: openacs-4/packages/acs-subsite/www/permissions/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/permissions/index-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/permissions/index-oracle.xql 30 Apr 2001 22:02:48 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/permissions/index-oracle.xql 28 Nov 2001 18:39:39 -0000 1.2 @@ -6,8 +6,8 @@ - select o.object_id, acs_object.name(o.object_id) as name - from acs_objects o, acs_object_party_privilege_map map + select distinct o.object_id, acs_object.name(o.object_id) as name + from acs_objects o, all_object_party_privilege_map map where map.object_id = o.object_id and map.party_id = :user_id and map.privilege = 'admin' Index: openacs-4/packages/acs-subsite/www/permissions/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/permissions/index-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-subsite/www/permissions/index-postgresql.xql 30 Apr 2001 22:02:48 -0000 1.2 +++ openacs-4/packages/acs-subsite/www/permissions/index-postgresql.xql 28 Nov 2001 18:39:39 -0000 1.3 @@ -6,8 +6,8 @@ - select o.object_id, acs_object__name(o.object_id) as name - from acs_objects o, acs_object_party_privilege_map map + select distinct o.object_id, acs_object.name(o.object_id) as name + from acs_objects o, all_object_party_privilege_map map where map.object_id = o.object_id and map.party_id = :user_id and map.privilege = 'admin' Index: openacs-4/packages/acs-subsite/www/permissions/one-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/permissions/one-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/permissions/one-oracle.xql 30 Apr 2001 22:02:48 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/permissions/one-oracle.xql 28 Nov 2001 18:39:39 -0000 1.2 @@ -60,7 +60,7 @@ from acs_objects o where context_id = :object_id and exists (select 1 - from acs_object_party_privilege_map + from all_object_party_privilege_map where object_id = o.object_id and party_id = :user_id and privilege = 'admin') Index: openacs-4/packages/acs-subsite/www/permissions/one-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/permissions/one-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-subsite/www/permissions/one-postgresql.xql 30 Apr 2001 22:02:48 -0000 1.2 +++ openacs-4/packages/acs-subsite/www/permissions/one-postgresql.xql 28 Nov 2001 18:39:39 -0000 1.3 @@ -60,7 +60,7 @@ from acs_objects o where context_id = :object_id and exists (select 1 - from acs_object_party_privilege_map + from all_object_party_privilege_map where object_id = o.object_id and party_id = :user_id and privilege = 'admin') Index: openacs-4/packages/acs-subsite/www/permissions/one.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/permissions/Attic/one.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/permissions/one.xql 30 Apr 2001 22:02:48 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/permissions/one.xql 28 Nov 2001 18:39:39 -0000 1.2 @@ -17,13 +17,9 @@ select count(*) as num_children from acs_objects o - where context_id = :object_id - and exists (select 1 - from acs_object_party_privilege_map - where object_id = o.object_id - and party_id = :user_id - and privilege = 'admin') - + where context_id = :object_id and + acs_permission__permission_p(o.object_id, :user_id, 'admin') + Index: openacs-4/packages/acs-tcl/tcl/acs-kernel-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/acs-kernel-procs.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-tcl/tcl/acs-kernel-procs.xql 24 Apr 2001 06:02:26 -0000 1.1 +++ openacs-4/packages/acs-tcl/tcl/acs-kernel-procs.xql 28 Nov 2001 18:39:39 -0000 1.2 @@ -7,7 +7,7 @@ select 1 as admin_exists_p from dual where exists (select 1 - from acs_object_party_privilege_map m, users u + from all_object_party_privilege_map m, users u where m.object_id = 0 and m.party_id = u.user_id and m.privilege = 'admin') Index: openacs-4/packages/calendar/www/admin/cal-item-permissions.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/admin/Attic/cal-item-permissions.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/calendar/www/admin/cal-item-permissions.xql 5 Sep 2001 13:44:56 -0000 1.2 +++ openacs-4/packages/calendar/www/admin/cal-item-permissions.xql 28 Nov 2001 18:39:39 -0000 1.3 @@ -15,8 +15,8 @@ - select privilege - from acs_object_party_privilege_map + select distinct privilege + from all_object_party_privilege_map where party_id = :party_id and object_id = :cal_item_id and privilege like '%cal_item%' Index: openacs-4/packages/calendar/www/admin/calendar-permissions.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/admin/Attic/calendar-permissions.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/calendar/www/admin/calendar-permissions.xql 5 Sep 2001 13:44:56 -0000 1.2 +++ openacs-4/packages/calendar/www/admin/calendar-permissions.xql 28 Nov 2001 18:39:39 -0000 1.3 @@ -15,8 +15,8 @@ - select privilege - from acs_object_party_privilege_map + select distinct privilege + from all_object_party_privilege_map where object_id = :calendar_id and party_id = :party_id and privilege like '%calendar%' Index: openacs-4/packages/calendar/www/admin/calendar-preferences-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/admin/Attic/calendar-preferences-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/calendar/www/admin/calendar-preferences-oracle.xql 5 Sep 2001 05:48:18 -0000 1.1 +++ openacs-4/packages/calendar/www/admin/calendar-preferences-oracle.xql 28 Nov 2001 18:39:39 -0000 1.2 @@ -17,25 +17,25 @@ - select unique(object_id) as calendar_id, + select unique(o.object_id) as calendar_id, calendar.name(object_id) as calendar_name, calendar.show_p(object_id, :party_id) as show_p - from acs_object_party_privilege_map - where calendar.readable_p(object_id, :party_id) = 't' - and party_id = :party_id - and acs_object_util.object_type_p(object_id, 'calendar') = 't' - and calendar.private_p(object_id) = 'f' + from acs_objects o + where calendar.readable_p(o.object_id, :party_id) = 't' + and o.object_id = :party_id + and acs_object_util.object_type_p(o.object_id, 'calendar') = 't' + and calendar.private_p(o.object_id) = 'f' union - select cal_item.on_which_calendar(object_id) as calendar_id, - calendar.name(cal_item.on_which_calendar(object_id)) as calendar_name, - calendar.show_p(cal_item.on_which_calendar(object_id), :party_id) as show_p - from acs_object_party_privilege_map + select cal_item.on_which_calendar(o.object_id) as calendar_id, + calendar.name(cal_item.on_which_calendar(o.object_id)) as calendar_name, + calendar.show_p(cal_item.on_which_calendar(o.object_id), :party_id) as show_p + from acs_objects o where privilege = 'cal_item_read' and party_id = :party_id - and acs_object_util.object_type_p(object_id, 'cal_item') = 't' - and calendar.private_p(cal_item.on_which_calendar(object_id)) = 'f' + and acs_object_util.object_type_p(o.object_id, 'cal_item') = 't' + and calendar.private_p(cal_item.on_which_calendar(o.object_id)) = 'f' Index: openacs-4/packages/calendar/www/admin/calendar-preferences-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/admin/Attic/calendar-preferences-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/calendar/www/admin/calendar-preferences-postgresql.xql 5 Sep 2001 13:44:56 -0000 1.2 +++ openacs-4/packages/calendar/www/admin/calendar-preferences-postgresql.xql 28 Nov 2001 18:39:39 -0000 1.3 @@ -17,25 +17,25 @@ - select distinct(object_id) as calendar_id, - calendar__name(object_id) as calendar_name, - calendar__show_p(object_id, :party_id) as show_p - from acs_object_party_privilege_map - where calendar__readable_p(object_id, :party_id) = 't' + select distinct(o.object_id) as calendar_id, + calendar__name(o.object_id) as calendar_name, + calendar__show_p(o.object_id, :party_id) as show_p + from acs_objects o + where calendar__readable_p(o.object_id, :party_id) = 't' and party_id = :party_id - and acs_object_util__object_type_p(object_id, 'calendar') = 't' - and calendar__private_p(object_id) = 'f' + and acs_object_util__object_type_p(o.object_id, 'calendar') = 't' + and calendar__private_p(o.object_id) = 'f' union - select cal_item__on_which_calendar(object_id) as calendar_id, - calendar__name(cal_item__on_which_calendar(object_id)) as calendar_name, - calendar__show_p(cal_item__on_which_calendar(object_id), :party_id) as show_p - from acs_object_party_privilege_map + select cal_item__on_which_calendar(o.object_id) as calendar_id, + calendar__name(cal_item__on_which_calendar(o.object_id)) as calendar_name, + calendar__show_p(cal_item__on_which_calendar(o.object_id), :party_id) as show_p + from acs_objects o where privilege = 'cal_item_read' and party_id = :party_id - and acs_object_util__object_type_p(object_id, 'cal_item') = 't' - and calendar__private_p(cal_item__on_which_calendar(object_id)) = 'f' + and acs_object_util__object_type_p(o.object_id, 'cal_item') = 't' + and calendar__private_p(cal_item__on_which_calendar(o.object_id)) = 'f'