postgresql7.1
select i.item_id as pres_item_id,
pres.pres_title,
ao.creation_date as creation_date,
ao.creation_user,
p.first_names || ' ' || p.last_name as full_name
from cr_items i, cr_wp_presentations pres, persons p, acs_objects ao
where i.live_revision = pres.presentation_id
and ao.object_id = i.item_id
and ao.creation_user = p.person_id
and pres.public_p = 't'
and ao.context_id = :package_id
$extra_where_clauses
select i.item_id as pres_item_id,
p.pres_title,
ao.creation_date as creation_date
from cr_items i, cr_wp_presentations p, acs_objects ao
where i.live_revision = p.presentation_id
and ao.object_id = i.item_id
and ao.creation_user = :user_id
and ao.context_id = :package_id
$extra_where_clauses
select i.item_id as pres_item_id,
pres.pres_title,
ao.creation_date as creation_date,
ao.creation_user,
p.first_names || ' ' || p.last_name as full_name,
acs_permission__permission_p(i.item_id, :user_id, 'wp_edit_presentation') as edit_p
from cr_items i, cr_wp_presentations pres, persons p, acs_objects ao
where i.live_revision = pres.presentation_id
and ao.object_id = i.item_id
and ao.creation_user <> :user_id
and ao.creation_user = p.person_id
and ao.context_id = :package_id
$extra_where_clauses
and acs_permission__permission_p(i.item_id, :user_id, 'wp_view_presentation')