function DBGetTablesListByGroup($db = "db") { if ($db == "db") { $tables = DBGetTablesList(); } elseif ($db == "project") { $tables = GetTablesListReport(); } else { $tables = GetTablesListCustom(); } $ret = array(); if ($db == "db") { $tables_admin = WRGetTableListAdmin("db"); } elseif ($db == "project") { $tables_admin = WRGetTableListAdmin("project"); } else { $tables_admin = WRGetTableListAdmin("custom"); } $userGroups = GetUserGroup(); // all tables foreach ($tables as $table_name) { if ($db == "custom") { $tablename = $table_name["sqlname"]; } else { $tablename = $table_name; } // permissions foreach ($tables_admin as $tablerights) { if ($tablerights["tablename"] != $tablename) { continue; } // user groups $found = false; if (!count($userGroups)) { // no groups at all $found = true; } elseif ($tablerights["group"] == "") { // initial table initialization $found = true; } else { foreach ($userGroups as $group) { if ((string) $group == $tablerights["group"]) { $found = true; break; } } } if ($found) { $ret[] = $table_name; break; } } } return $ret; }
{ $_SESSION["MyURL"]=$_SERVER["SCRIPT_NAME"]."?".$_SERVER["QUERY_STRING"]; header("Location: ".GetTableLink("webreport")); return; } //$conn=db_connect(); include('include/xtempl.php'); $xt = new Xtempl(); $tables_admin_db = WRGetTableListAdmin("db"); $tables_admin_project = WRGetTableListAdmin("project"); $tables_admin_custom = WRGetTableListAdmin("custom"); $arr_tables_db = DBGetTablesList(); $arr_tables_project = GetTablesListReport(); $arr_tables_custom = GetTablesListCustom(); $groups = array(); if(!$wr_is_standalone) $arr_UserGroups = GetUserGroups(); else { $arr_UserGroups = array(); foreach(GetUserGroups() as $idx=>$value) if($value[0]!="Guest") $arr_UserGroups[]=$value; } $group_list="";