function show_permission_list($template_name) { global $TPL; $roles = permission::get_roles(); if ($_REQUEST["submit"] || $_REQUEST["filter"] != "") { $where = " where tableName like '%" . db_esc($_REQUEST["filter"]) . "%' "; // TODO: Add filtering to permission list } $db = new db_alloc(); $db->query("SELECT * FROM permission {$where} ORDER BY tableName, sortKey"); while ($db->next_record()) { $permission = new permission(); $permission->read_db_record($db); $permission->set_values(); $TPL["actions"] = $permission->describe_actions(); $TPL["odd_even"] = $TPL["odd_even"] == "odd" ? "even" : "odd"; $TPL["roleName"] = $roles[$TPL["roleName"]]; include_template($template_name); } }
require_once "../alloc.php"; $permission = new permission(); $permissionID = $_POST["permissionID"] or $permissionID = $_GET["permissionID"]; if ($permissionID) { $permission->set_id($permissionID); $permission->select(); } $actions_array = $_POST["actions_array"]; if (is_array($actions_array)) { $actions = 0; foreach ($actions_array as $k => $a) { $actions = $actions | $a; } } $permission->read_globals(); $permission->set_values(); if (!$permission->get_value("tableName")) { global $modules; $entities = array(); reset($modules); while (list($module_name, $module) = each($modules)) { $mod_entities = $module->db_entities; $entities = array_merge($entities, $mod_entities); } $table_names = array(); reset($entities); while (list(, $entity_name) = each($entities)) { $entity = new $entity_name(); $table_names[] = $entity->data_table; } $ops = $table_names;