Allow reapeater services to be turned off (#6602)
[openemr.git] / gacl / admin / acl_test3.php
blob3b5d1a335a8e62a03f3f2550421677521f1b1ab1
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 require_once("../../interface/globals.php");
13 use OpenEMR\Common\Acl\AclMain;
14 use OpenEMR\Common\Twig\TwigContainer;
16 //ensure user has proper access
17 if (!AclMain::aclCheckCore('admin', 'acl')) {
18 echo (new TwigContainer(null, $GLOBALS['kernel']))->getTwig()->render('core/unauthorized.html.twig', ['pageTitle' => xl("ACL Administration")]);
19 exit;
22 @set_time_limit(600);
24 require_once('../profiler.inc.php');
25 $profiler = new Profiler(true,true);
27 require_once("gacl_admin.inc.php");
29 $query = '
30 SELECT a.value AS a_value, a.name AS a_name,
31 b.value AS b_value, b.name AS b_name,
32 c.value AS c_value, c.name AS c_name,
33 d.value AS d_value, d.name AS d_name
34 FROM '. $gacl_api->_db_table_prefix .'aco_sections a
35 LEFT JOIN '. $gacl_api->_db_table_prefix .'aco b ON a.value=b.section_value,
36 '. $gacl_api->_db_table_prefix .'aro_sections c
37 LEFT JOIN '. $gacl_api->_db_table_prefix .'aro d ON c.value=d.section_value
38 ORDER BY a.value, b.value, c.value, d.value';
41 $query = '
42 SELECT a.value AS a_value, a.name AS a_name,
43 b.value AS b_value, b.name AS b_name,
44 c.value AS c_value, c.name AS c_name,
45 d.value AS d_value, d.name AS d_name,
46 e.value AS e_value, e.name AS e_name,
47 f.value AS f_value, f.name AS f_name
48 FROM '. $gacl_api->_db_table_prefix .'aco_sections a
49 LEFT JOIN '. $gacl_api->_db_table_prefix .'aco b ON a.value=b.section_value,
50 '. $gacl_api->_db_table_prefix .'aro_sections c
51 LEFT JOIN '. $gacl_api->_db_table_prefix .'aro d ON c.value=d.section_value,
52 '. $gacl_api->_db_table_prefix .'axo_sections e
53 LEFT JOIN '. $gacl_api->_db_table_prefix .'axo f ON e.value=f.section_value
54 ORDER BY a.value, b.value, c.value, d.value, e.value, f.value';
57 //$rs = $db->Execute($query);
58 $rs = $db->pageexecute($query, $gacl_api->_items_per_page, ($_GET['page'] ?? null));
59 $rows = $rs->GetRows();
62 echo("<pre>");
63 print_r($rows);
64 echo("</pre>");
67 $total_rows = count($rows);
69 foreach ($rows as $row) {
70 list( $aco_section_value,
71 $aco_section_name,
72 $aco_value,
73 $aco_name,
75 $aro_section_value,
76 $aro_section_name,
77 $aro_value,
78 $aro_name,
80 $axo_section_value,
81 $axo_section_name,
82 $axo_value,
83 $axo_name
84 ) = $row;
86 $acl_check_begin_time = $profiler->getMicroTime();
87 $acl_result = $gacl->acl_query($aco_section_value, $aco_value, $aro_section_value, $aro_value, $axo_section_value, $axo_value);
88 $acl_check_end_time = $profiler->getMicroTime();
90 $access = &$acl_result['allow'];
91 $return_value = &$acl_result['return_value'];
93 $acl_check_time = ($acl_check_end_time - $acl_check_begin_time) * 1000;
94 $total_acl_check_time += $acl_check_time;
96 if ($aco_section_name != $tmp_aco_section_name OR $aco_name != $tmp_aco_name) {
97 $display_aco_name = "$aco_section_name > $aco_name";
98 } else {
99 $display_aco_name = "";
102 $acls[] = array(
103 'aco_section_value' => $aco_section_value,
104 'aco_section_name' => $aco_section_name,
105 'aco_value' => $aco_value,
106 'aco_name' => $aco_name,
108 'aro_section_value' => $aro_section_value,
109 'aro_section_name' => $aro_section_name,
110 'aro_value' => $aro_value,
111 'aro_name' => $aro_name,
113 'axo_section_value' => $axo_section_value,
114 'axo_section_name' => $axo_section_name,
115 'axo_value' => $axo_value,
116 'axo_name' => $axo_name,
118 'access' => $access,
119 'return_value' => $return_value,
120 'acl_check_time' => number_format($acl_check_time, 2),
122 'display_aco_name' => $display_aco_name,
125 $tmp_aco_section_name = $aco_section_name;
126 $tmp_aco_name = $aco_name;
129 //echo "<br /><br />$x ACL_CHECK()'s<br />\n";
131 $smarty->assign("acls", ($acls ?? null));
133 $smarty->assign("total_acl_checks", $total_rows);
134 $smarty->assign("total_acl_check_time", ($total_acl_check_time ?? null));
136 if ($total_rows > 0) {
137 $avg_acl_check_time = $total_acl_check_time / $total_rows;
139 $smarty->assign("avg_acl_check_time", number_format((($avg_acl_check_time ?? 0) + 0) ,2));
141 $smarty->assign("paging_data", $gacl_api->get_paging_data($rs));
143 $smarty->assign("return_page", $_SERVER['PHP_SELF'] );
145 $smarty->assign('current','acl_test');
146 $smarty->assign('page_title', '3-dim. ACL Test');
148 $smarty->assign("phpgacl_version", $gacl_api->get_version() );
149 $smarty->assign("phpgacl_schema_version", $gacl_api->get_schema_version() );
151 $smarty->display('phpgacl/acl_test3.tpl');