bug_tracker::set_access_policy (private)

 bug_tracker::set_access_policy [ -all_bugs ] [ -user_bugs ]

Defined in packages/bug-tracker/tcl/bug-tracker-procs.tcl

Set/unset direct permissions on existing bugs.

Switches:
-all_bugs (optional, boolean, defaults to "f")
The user can see all bugs
-user_bugs (optional, boolean, defaults to "f")
The user can only see the bugs they are participating in.

Partial Call Graph (max 5 caller/called nodes):
%3 packages/bug-tracker/www/admin/access-policy-edit.tcl packages/bug-tracker/ www/admin/access-policy-edit.tcl bug_tracker::set_access_policy bug_tracker::set_access_policy packages/bug-tracker/www/admin/access-policy-edit.tcl->bug_tracker::set_access_policy ad_conn ad_conn (public) bug_tracker::set_access_policy->ad_conn bug_tracker::grant_direct_read_permission bug_tracker::grant_direct_read_permission (private) bug_tracker::set_access_policy->bug_tracker::grant_direct_read_permission bug_tracker::inherit bug_tracker::inherit (private) bug_tracker::set_access_policy->bug_tracker::inherit db_list db_list (public) bug_tracker::set_access_policy->db_list

Testcases:
No testcase defined.
Source code:
    if {$all_bugs_p && $user_bugs_p} {
        error "Select either -all_bugs or -user_bugs but not both"
    }
    set package_id [ad_conn package_id]
    set all_users [db_list get_all_users {}]
    if {$all_bugs_p} {
        set bug_ids [db_list get_all_bugs {}]
        foreach user_id $all_users {
            foreach bug_id $bug_ids {
                bug_tracker::inherit -bug_id $bug_id -party_id $user_id
            }
        }
    } elseif {$user_bugs_p} {
        foreach user_id $all_users {
            set bug_ids [db_list get_user_bugs {}]
            foreach bug_id $bug_ids {
                bug_tracker::grant_direct_read_permission -bug_id $bug_id -party_id $user_id
            }
        }
    }
Generic XQL file:
<fullquery name="bug_tracker::set_access_policy.get_all_bugs">
    <querytext>
          select bug_id
            from bt_bugs
      </querytext>
</fullquery>

<fullquery name="bug_tracker::set_access_policy.get_user_bugs">
    <querytext>
          select bug_id
            from bt_bugs
           where project_id = :package_id
             and bug_id in (select wc.object_id
                              from workflow_cases wc,
                                   workflow_case_role_party_map rpm 
                             where wc.case_id = rpm.case_id
                               and rpm.party_id = :user_id)
      </querytext>
</fullquery>

<fullquery name="bug_tracker::set_access_policy.get_all_users">
    <querytext>
        select distinct rpm.party_id
          from workflow_cases wc,
               workflow_case_role_party_map rpm,
               bt_bugs b
         where wc.case_id = rpm.case_id
           and b.bug_id = wc.object_id
           and b.project_id = :package_id
      </querytext>
</fullquery>
packages/bug-tracker/tcl/bug-tracker-procs.xql

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

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

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