postgresql7.1
select
p.privilege,
cms_permission__permission_p (
:object_id, :user_id, p.privilege
) as is_granted
from
acs_privileges p
select
acs_object__name(:object_id) as obj_name,
pretty_name as perm_name
from
acs_privileges
where
privilege = :privilege
select
t.child_privilege as privilege,
lpad(' ', t.tree_level * 24, ' ') || coalesce(p.pretty_name, t.child_privilege) as label,
cms_permission__permission_p(:object_id, :grantee_id, t.child_privilege) as permission_p,
cms_permission__permission_p (:object_id, :grantee_id, t.privilege) as parent_permission_p
from (select h1.privilege, h1.child_privilege,
tree_level(h1.tree_sortkey) as tree_level
from acs_privilege_hierarchy_index h1, acs_privilege_hierarchy_index h2
where h2.privilege = 'cm_root'
and h1.tree_sortkey between h2.tree_sortkey and tree_right(h2.tree_sortkey)
and tree_ancestor_p(h2.tree_sortkey, h1.tree_sortkey)
) t, acs_privileges p
where
p.privilege = t.child_privilege
and (
cms_permission__has_grant_authority (
:object_id, :user_id, t.child_privilege
) = 't'
or
cms_permission__has_revoke_authority (
:object_id, :user_id, t.child_privilege, :grantee_id
) = 't'
)
select cms_permission__grant_permission (:object_id, :user_id, :privilege, :grantee_id, :pf_is_recursive)
select cms_permission__revoke_permission (:object_id, :user_id, :privilege, :grantee_id, :pf_is_recursive)