oracle8.1.6
select cr.title,
cr.description,
pa.story,
ci.parent_id as parent_folder_id,
decode(acs_permission.permission_p(ci.item_id, :user_id, 'admin'),'t',1,0) as admin_p,
decode(acs_permission.permission_p(ci.item_id, :user_id, 'pa_create_photo'),'t',1,0) as photo_p,
decode(acs_permission.permission_p(ci.item_id, :user_id, 'write'),'t',1,0) as write_p,
decode(acs_permission.permission_p(ci.parent_id, :user_id, 'write'),'t',1,0) as folder_write_p,
decode(acs_permission.permission_p(ci.item_id, :user_id, 'delete'),'t',1,0) as album_delete_p
from cr_items ci,
cr_revisions cr,
pa_albums pa
where ci.live_revision = cr.revision_id
and ci.live_revision = pa_album_id
and ci.item_id = :album_id