changing test for effective end date to include enddate which is NULL
[openemr.git] / gacl / admin / acl_test3.php
blobf6cb78943d3542ed8c45f1bd48fc5db70df6d8b2
1 <?php
2 /*
3 meinhard_jahn@web.de, 20041102: axo implemented
4 */
5 /*
6 if (!empty($_GET['debug'])) {
7 $debug = $_GET['debug'];
9 */
10 //First make sure user has access
11 include_once("../../interface/globals.php");
12 include_once("$srcdir/acl.inc");
13 //ensure user has proper access
14 if (!acl_check('admin', 'acl')) {
15 echo xl('ACL Administration Not Authorized');
16 exit;
18 //ensure php is installed
19 if (!isset($phpgacl_location)) {
20 echo xl('php-GACL access controls are turned off');
21 exit;
24 @set_time_limit(600);
26 require_once('../profiler.inc');
27 $profiler = new Profiler(true,true);
29 require_once("gacl_admin.inc.php");
31 $query = '
32 SELECT a.value AS a_value, a.name AS a_name,
33 b.value AS b_value, b.name AS b_name,
34 c.value AS c_value, c.name AS c_name,
35 d.value AS d_value, d.name AS d_name
36 FROM '. $gacl_api->_db_table_prefix .'aco_sections a
37 LEFT JOIN '. $gacl_api->_db_table_prefix .'aco b ON a.value=b.section_value,
38 '. $gacl_api->_db_table_prefix .'aro_sections c
39 LEFT JOIN '. $gacl_api->_db_table_prefix .'aro d ON c.value=d.section_value
40 ORDER BY a.value, b.value, c.value, d.value';
43 $query = '
44 SELECT a.value AS a_value, a.name AS a_name,
45 b.value AS b_value, b.name AS b_name,
46 c.value AS c_value, c.name AS c_name,
47 d.value AS d_value, d.name AS d_name,
48 e.value AS e_value, e.name AS e_name,
49 f.value AS f_value, f.name AS f_name
50 FROM '. $gacl_api->_db_table_prefix .'aco_sections a
51 LEFT JOIN '. $gacl_api->_db_table_prefix .'aco b ON a.value=b.section_value,
52 '. $gacl_api->_db_table_prefix .'aro_sections c
53 LEFT JOIN '. $gacl_api->_db_table_prefix .'aro d ON c.value=d.section_value,
54 '. $gacl_api->_db_table_prefix .'axo_sections e
55 LEFT JOIN '. $gacl_api->_db_table_prefix .'axo f ON e.value=f.section_value
56 ORDER BY a.value, b.value, c.value, d.value, e.value, f.value';
59 //$rs = $db->Execute($query);
60 $rs = $db->pageexecute($query, $gacl_api->_items_per_page, $_GET['page']);
61 $rows = $rs->GetRows();
64 echo("<pre>");
65 print_r($rows);
66 echo("</pre>");
69 $total_rows = count($rows);
71 while (list(,$row) = @each(&$rows)) {
72 list( $aco_section_value,
73 $aco_section_name,
74 $aco_value,
75 $aco_name,
77 $aro_section_value,
78 $aro_section_name,
79 $aro_value,
80 $aro_name,
82 $axo_section_value,
83 $axo_section_name,
84 $axo_value,
85 $axo_name
86 ) = $row;
88 $acl_check_begin_time = $profiler->getMicroTime();
89 $acl_result = $gacl->acl_query($aco_section_value, $aco_value, $aro_section_value, $aro_value, $axo_section_value, $axo_value);
90 $acl_check_end_time = $profiler->getMicroTime();
92 $access = &$acl_result['allow'];
93 $return_value = &$acl_result['return_value'];
95 $acl_check_time = ($acl_check_end_time - $acl_check_begin_time) * 1000;
96 $total_acl_check_time += $acl_check_time;
98 if ($aco_section_name != $tmp_aco_section_name OR $aco_name != $tmp_aco_name) {
99 $display_aco_name = "$aco_section_name > $aco_name";
100 } else {
101 $display_aco_name = "<br>";
104 $acls[] = array(
105 'aco_section_value' => $aco_section_value,
106 'aco_section_name' => $aco_section_name,
107 'aco_value' => $aco_value,
108 'aco_name' => $aco_name,
110 'aro_section_value' => $aro_section_value,
111 'aro_section_name' => $aro_section_name,
112 'aro_value' => $aro_value,
113 'aro_name' => $aro_name,
115 'axo_section_value' => $axo_section_value,
116 'axo_section_name' => $axo_section_name,
117 'axo_value' => $axo_value,
118 'axo_name' => $axo_name,
120 'access' => $access,
121 'return_value' => $return_value,
122 'acl_check_time' => number_format($acl_check_time, 2),
124 'display_aco_name' => $display_aco_name,
127 $tmp_aco_section_name = $aco_section_name;
128 $tmp_aco_name = $aco_name;
131 //echo "<br><br>$x ACL_CHECK()'s<br>\n";
133 $smarty->assign("acls", $acls);
135 $smarty->assign("total_acl_checks", $total_rows);
136 $smarty->assign("total_acl_check_time", $total_acl_check_time);
138 if ($total_rows > 0) {
139 $avg_acl_check_time = $total_acl_check_time / $total_rows;
141 $smarty->assign("avg_acl_check_time", number_format( ($avg_acl_check_time + 0) ,2));
143 $smarty->assign("paging_data", $gacl_api->get_paging_data($rs));
145 $smarty->assign("return_page", $_SERVER['PHP_SELF'] );
147 $smarty->assign('current','acl_test');
148 $smarty->assign('page_title', '3-dim. ACL Test');
150 $smarty->assign("phpgacl_version", $gacl_api->get_version() );
151 $smarty->assign("phpgacl_schema_version", $gacl_api->get_schema_version() );
153 $smarty->display('phpgacl/acl_test3.tpl');