/usr/share/phpgacl/admin/acl_list.php is in phpgacl 3.3.7-7.3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | <?php
require_once('gacl_admin.inc.php');
switch ($_GET['action']) {
case 'Delete':
$gacl_api->debug_text('Delete!');
if (is_array ($_GET['delete_acl']) AND !empty($_GET['delete_acl'])) {
foreach($_GET['delete_acl'] as $id) {
$gacl_api->del_acl($id);
}
}
//Return page.
$gacl_api->return_page($_GET['return_page']);
break;
case 'Submit':
$gacl_api->debug_text('Submit!!');
break;
default:
/*
* When the user requests to filter the list, run the filter and get just the matching IDs.
* Use these IDs to get the entire ACL information in the second query.
*
* If we just put the LIKE statements in the second query, it will match the correct ACLs
* but will only return the matching rows, so it won't show the entire ACL information.
*
*/
if (isset($_GET['action']) AND $_GET['action'] == 'Filter') {
$gacl_api->debug_text('Filtering...');
$query = '
SELECT DISTINCT a.id
FROM '. $gacl_api->_db_table_prefix .'acl a
LEFT JOIN '. $gacl_api->_db_table_prefix .'aco_map ac ON ac.acl_id=a.id
LEFT JOIN '. $gacl_api->_db_table_prefix .'aro_map ar ON ar.acl_id=a.id
LEFT JOIN '. $gacl_api->_db_table_prefix .'axo_map ax ON ax.acl_id=a.id';
if ( isset($_GET['filter_aco_section']) AND $_GET['filter_aco_section'] != '-1') {
$filter_query[] = 'ac.section_value='. $db->qstr(strtolower($_GET['filter_aco_section']));
}
if ( isset($_GET['filter_aco']) AND $_GET['filter_aco'] != '') {
$query .= '
LEFT JOIN '. $gacl_api->_db_table_prefix .'aco c ON (c.section_value=ac.section_value AND c.value=ac.value)';
$name = $db->qstr(strtolower($_GET['filter_aco']));
$filter_query[] = '(lower(c.value) LIKE '. $name .' OR lower(c.name) LIKE '. $name .')';
}
if ( isset($_GET['filter_aro_section']) AND $_GET['filter_aro_section'] != '-1') {
$filter_query[] = 'ar.section_value='. $db->qstr(strtolower($_GET['filter_aro_section']));
}
if ( isset($_GET['filter_aro']) AND $_GET['filter_aro'] != '') {
$query .= '
LEFT JOIN '. $gacl_api->_db_table_prefix .'aro r ON (r.section_value=ar.section_value AND r.value=ar.value)';
$name = $db->qstr(strtolower($_GET['filter_aro']));
$filter_query[] = '(lower(r.value) LIKE '. $name .' OR lower(r.name) LIKE '. $name .')';
}
if ( isset($_GET['filter_aro_group']) AND $_GET['filter_aro_group'] != '') {
$query .= '
LEFT JOIN '. $gacl_api->_db_table_prefix .'aro_groups_map arg ON arg.acl_id=a.id
LEFT JOIN '. $gacl_api->_db_table_prefix .'aro_groups rg ON rg.id=arg.group_id';
$filter_query[] = '(lower(rg.name) LIKE '. $db->qstr(strtolower($_GET['filter_aro_group'])) .')';
}
if ( isset($_GET['filter_axo_section']) AND $_GET['filter_axo_section'] != '-1') {
$filter_query[] = 'ax.section_value='. $db->qstr(strtolower($_GET['filter_axo_section']));
}
if ( isset($_GET['filter_axo']) AND $_GET['filter_axo'] != '') {
$query .= '
LEFT JOIN '. $gacl_api->_db_table_prefix .'axo x ON (x.section_value=ax.section_value AND x.value=ax.value)';
$name = $db->qstr(strtolower($_GET['filter_axo']));
$filter_query[] = '(lower(x.value) LIKE '. $name .' OR lower(x.name) LIKE '. $name .')';
}
if ( isset($_GET['filter_axo_group']) AND $_GET['filter_axo_group'] != '') {
$query .= '
LEFT JOIN '. $gacl_api->_db_table_prefix .'axo_groups_map axg ON axg.acl_id=a.id
LEFT JOIN '. $gacl_api->_db_table_prefix .'axo_groups xg ON xg.id=axg.group_id';
$filter_query[] = '(lower(xg.name) LIKE '. $db->qstr(strtolower($_GET['filter_axo_group'])) .')';
}
if ( isset($_GET['filter_acl_section']) AND $_GET['filter_acl_section'] != '-1') {
$filter_query[] = 'a.section_value='. $db->qstr(strtolower($_GET['filter_acl_section']));
}
if ( isset($_GET['filter_return_value']) AND $_GET['filter_return_value'] != '') {
$filter_query[] = '(lower(a.return_value) LIKE '. $db->qstr(strtolower($_GET['filter_return_value'])) .')';
}
if ( isset($_GET['filter_allow']) AND $_GET['filter_allow'] != '-1') {
$filter_query[] = '(a.allow LIKE '. $db->qstr($_GET['filter_allow']) .')';
}
if ( isset($_GET['filter_enabled']) AND $_GET['filter_enabled'] != '-1') {
$filter_query[] = '(a.enabled LIKE '. $db->qstr($_GET['filter_enabled']) .')';
}
if (isset($filter_query) AND is_array($filter_query)) {
$query .= '
WHERE '. implode(' AND ', $filter_query);
}
} else {
$query = '
SELECT a.id FROM ' . $gacl_api->_db_table_prefix . 'acl a';
}
$query .= '
ORDER BY a.id ASC';
$acl_ids = array();
$rs = $db->PageExecute($query, $gacl_api->_items_per_page, $_GET['page']);
if ( is_object($rs) ) {
$smarty->assign('paging_data', $gacl_api->get_paging_data($rs));
while ( $row = $rs->FetchRow() ) {
$acl_ids[] = $row[0];
}
$rs->Close();
}
if ( !empty($acl_ids) ) {
$acl_ids_sql = implode(',', $acl_ids);
} else {
//This shouldn't match any ACLs, returning 0 rows.
$acl_ids_sql = -1;
}
$acls = array();
//If the user is searching, and there are no results, don't run the query at all
if ( !($_GET['action'] == 'Filter' AND $acl_ids_sql == -1) ) {
// grab acl details
$query = '
SELECT a.id,x.name,a.allow,a.enabled,a.return_value,a.note,a.updated_date
FROM '. $gacl_api->_db_table_prefix .'acl a
INNER JOIN '. $gacl_api->_db_table_prefix .'acl_sections x ON x.value=a.section_value
WHERE a.id IN ('. $acl_ids_sql . ')';
$rs = $db->Execute($query);
if ( is_object($rs) ) {
while ( $row = $rs->FetchRow() ) {
$acls[$row[0]] = array(
'id' => $row[0],
// 'section_id' => $section_id,
'section_name' => $row[1],
'allow' => (bool)$row[2],
'enabled' => (bool)$row[3],
'return_value' => $row[4],
'note' => $row[5],
'updated_date' => $row[6],
'aco' => array(),
'aro' => array(),
'aro_groups' => array(),
'axo' => array(),
'axo_groups' => array()
);
}
}
// grab ACO, ARO and AXOs
foreach ( array('aco', 'aro', 'axo') as $type ) {
$query = '
SELECT a.acl_id,o.name,s.name
FROM '. $gacl_api->_db_table_prefix . $type .'_map a
INNER JOIN '. $gacl_api->_db_table_prefix . $type .' o ON (o.section_value=a.section_value AND o.value=a.value)
INNER JOIN '. $gacl_api->_db_table_prefix . $type . '_sections s ON s.value=a.section_value
WHERE a.acl_id IN ('. $acl_ids_sql . ')';
$rs = $db->Execute($query);
if ( is_object($rs) ) {
while ( $row = $rs->FetchRow() ) {
list($acl_id, $name, $section_name) = $row;
if ( isset($acls[$acl_id]) ) {
$acls[$acl_id][$type][$section_name][] = $name;
}
}
}
}
// grab ARO and AXO groups
foreach ( array('aro', 'axo') as $type )
{
$query = '
SELECT a.acl_id,g.name
FROM '. $gacl_api->_db_table_prefix . $type .'_groups_map a
INNER JOIN '. $gacl_api->_db_table_prefix . $type .'_groups g ON g.id=a.group_id
WHERE a.acl_id IN ('. $acl_ids_sql . ')';
$rs = $db->Execute($query);
if ( is_object($rs) ) {
while ( $row = $rs->FetchRow () ) {
list($acl_id, $name) = $row;
if ( isset($acls[$acl_id]) ) {
$acls[$acl_id][$type .'_groups'][] = $name;
}
}
}
}
}
$smarty->assign('acls', $acls);
$smarty->assign('filter_aco', $_GET['filter_aco']);
$smarty->assign('filter_aro', $_GET['filter_aro']);
$smarty->assign('filter_aro_group', $_GET['filter_aro_group']);
$smarty->assign('filter_axo', $_GET['filter_axo']);
$smarty->assign('filter_axo_group', $_GET['filter_axo_group']);
$smarty->assign('filter_return_value', $_GET['filter_return_value']);
foreach(array('aco','aro','axo','acl') as $type) {
//
//Grab all sections for select box
//
$options = array (
-1 => 'Any'
);
$query = '
SELECT value,name
FROM '. $gacl_api->_db_table_prefix .$type .'_sections
WHERE hidden=0
ORDER BY order_value,name';
$rs = $db->Execute($query);
if ( is_object($rs) ) {
while ($row = $rs->FetchRow()) {
$options[$row[0]] = $row[1];
}
}
$smarty->assign('options_filter_'. $type . '_sections', $options);
if (!isset($_GET['filter_' . $type . '_section']) OR $_GET['filter_' . $type . '_section'] == '') {
$_GET['filter_' . $type . '_section'] = '-1';
}
$smarty->assign('filter_' . $type . '_section', $_GET['filter_' . $type .'_section']);
}
$smarty->assign('options_filter_allow', array('-1' => 'Any', 1 => 'Allow', 0 => 'Deny'));
$smarty->assign('options_filter_enabled', array('-1' => 'Any', 1 => 'Yes', 0 => 'No'));
if (!isset($_GET['filter_allow']) OR $_GET['filter_allow'] == '') {
$_GET['filter_allow'] = '-1';
}
if (!isset($_GET['filter_enabled']) OR $_GET['filter_enabled'] == '') {
$_GET['filter_enabled'] = '-1';
}
$smarty->assign('filter_allow', $_GET['filter_allow']);
$smarty->assign('filter_enabled', $_GET['filter_enabled']);
}
$smarty->assign('action', $_GET['action']);
$smarty->assign('return_page', $_SERVER['PHP_SELF']);
$smarty->assign('current','acl_list');
$smarty->assign('page_title', 'ACL List');
$smarty->assign('phpgacl_version', $gacl_api->get_version());
$smarty->assign('phpgacl_schema_version', $gacl_api->get_schema_version());
$smarty->display('phpgacl/acl_list.tpl');
?>
|