fs_children_have_permission_p (private)

 fs_children_have_permission_p [ -user_id user_id ] item_id privilege

Defined in packages/file-storage/tcl/file-storage-procs.tcl

This procedure, given a content item and a privilege, checks to see if there are any children of the item on which the user does not have that privilege.

Switches:
-user_id (optional)
Parameters:
item_id (required)
privilege (required)
Returns:
0 if there is any child item on which the user does not have the privilege. It returns 1 if the user has the privilege on every child item.

Partial Call Graph (max 5 caller/called nodes):
%3 packages/file-storage/www/folder-delete.tcl packages/file-storage/ www/folder-delete.tcl fs_children_have_permission_p fs_children_have_permission_p packages/file-storage/www/folder-delete.tcl->fs_children_have_permission_p ad_conn ad_conn (public) fs_children_have_permission_p->ad_conn db_string db_string (public) fs_children_have_permission_p->db_string

Testcases:
No testcase defined.
Source code:
    if {$user_id eq ""} {
        set user_id [ad_conn user_id]
    }

    # Check that no item or revision over the whole cr_item
    # descendants hierarchy does not have the required permissison.
    set all_children_have_privilege_p [db_string all_children_have_privilege {
        with recursive children(item_id) as (
            select cast(:item_id as integer) as item_id
            union all
            select i.item_id
            from cr_items i,
                 children c
            where i.parent_id = c.item_id
        )
        select not exists (select 1 from children
                            where acs_permission.permission_p(item_id, :user_id, :privilege) = 'f')
           and not exists (select 1 from cr_revisions
                            where item_id in (select item_id from children)
                              and acs_permission.permission_p(revision_id, :user_id, :privilege) = 'f')
          from dual
    }]
    return [expr {$all_children_have_privilege_p ? 1 : 0}]
Generic XQL file:
packages/file-storage/tcl/file-storage-procs.xql

PostgreSQL XQL file:
packages/file-storage/tcl/file-storage-procs-postgresql.xql

Oracle XQL file:
packages/file-storage/tcl/file-storage-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: