oracle8.1.6
select
e.element_id,
e.name,
e.description,
decode(e.exportable_p, 't', 1, 'f', 0) as exportable_p,
decode(d.configurable_p, 't', 1, 'f', 0) as configurable_p,
decode(acs_permission.permission_p(e.element_id, :user_id, 'write'), 't', 1, 'f', 0) as write_p,
decode(m.portal_id, e.controlling_portal_id, 1, 0) as local_p
from portal_elements e, portal_available_element_map m, portal_datasources d
where
m.portal_id = :default_portal_id and
m.element_id = e.element_id and
e.datasource_id = d.datasource_id