2011-11-25 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_agents.php operation/menu.php operation/gis_maps/render_view.php operation/gis_maps/index.php godmode/gis_maps/index.php: Fixed a problem with agent groups in gis maps. Fixes: #3438313 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5173 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
01afa82637
commit
edb3b2e485
|
@ -1,3 +1,14 @@
|
|||
2011-11-25 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||
|
||||
* include/functions_agents.php
|
||||
operation/menu.php
|
||||
operation/gis_maps/render_view.php
|
||||
operation/gis_maps/index.php
|
||||
godmode/gis_maps/index.php: Fixed a problem with agent groups in
|
||||
gis maps.
|
||||
|
||||
Fixes: #3438313
|
||||
|
||||
2011-11-25 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/graphs/functions_gd.php: Fixed rounded corners in progress bar
|
||||
|
|
|
@ -85,9 +85,7 @@ $table->data = array();
|
|||
|
||||
$defaultMapId = null;
|
||||
|
||||
if (!$maps) {
|
||||
echo '<div class="nf">'.('No maps defined').'</div>';
|
||||
} else {
|
||||
if ($maps){
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
foreach ($maps as $map) {
|
||||
if (!check_acl ($config["id_user"], $map["group_id"], "IR")) {
|
||||
|
@ -113,7 +111,12 @@ if (!$maps) {
|
|||
array_push ($table_info, $buttons);
|
||||
$table->data[] = $table_info;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty ($table->data)) {
|
||||
html_print_table($table);
|
||||
} else {
|
||||
echo '<div class="nf">'.('No maps defined').'</div>';
|
||||
}
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
|
|
@ -386,6 +386,7 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
|
|||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$limit_sql = '';
|
||||
if(isset($offset) && isset($limit)) {
|
||||
$limit_sql = " LIMIT $offset, $limit ";
|
||||
}
|
||||
|
@ -765,10 +766,11 @@ function agents_common_modules ($id_agent, $filter = false, $indexed = true, $ge
|
|||
* @param string $case Which case to return the agentname as (lower, upper, none)
|
||||
* @param boolean $noACL jump the ACL test.
|
||||
* @param boolean $childGroups The flag to get agents in the child group of group parent passed. By default false.
|
||||
* @param boolean $extra_access The flag to get agents of extra access policies.
|
||||
*
|
||||
* @return array An array with all agents in the group or an empty array
|
||||
*/
|
||||
function agents_get_group_agents ($id_group = 0, $search = false, $case = "lower", $noACL = false, $childGroups = false) {
|
||||
function agents_get_group_agents ($id_group = 0, $search = false, $case = "lower", $noACL = false, $childGroups = false, $extra_access = true) {
|
||||
global $config;
|
||||
|
||||
if (!$noACL) {
|
||||
|
@ -858,11 +860,16 @@ function agents_get_group_agents ($id_group = 0, $search = false, $case = "lower
|
|||
|
||||
enterprise_include_once ('include/functions_policies.php');
|
||||
|
||||
$extra_sql = enterprise_hook('policies_get_agents_sql_condition');
|
||||
if ($extra_sql === ENTERPRISE_NOT_HOOK) {
|
||||
if ($extra_access){
|
||||
$extra_sql = enterprise_hook('policies_get_agents_sql_condition');
|
||||
if ($extra_sql === ENTERPRISE_NOT_HOOK) {
|
||||
$extra_sql = '';
|
||||
}else if ($extra_sql != '') {
|
||||
$extra_sql .= ' OR ';
|
||||
}
|
||||
}
|
||||
else{
|
||||
$extra_sql = '';
|
||||
}else if ($extra_sql != '') {
|
||||
$extra_sql .= ' OR ';
|
||||
}
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
|
@ -874,7 +881,7 @@ function agents_get_group_agents ($id_group = 0, $search = false, $case = "lower
|
|||
$sql = sprintf ("SELECT id_agente, nombre FROM tagente WHERE %s (%s) ORDER BY dbms_lob.substr(nombre,4000,1)", $extra_sql, $search_sql);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$result = db_get_all_rows_sql ($sql);
|
||||
|
||||
if ($result === false)
|
||||
|
|
|
@ -38,6 +38,12 @@ $table->align[1] = 'center';
|
|||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
|
||||
$own_info = get_user_info ($config['id_user']);
|
||||
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
||||
$own_groups = array_keys(users_get_groups($config['id_user'], "IR"));
|
||||
else
|
||||
$own_groups = array_keys(users_get_groups($config['id_user'], "IR", false));
|
||||
|
||||
if ($maps !== false) {
|
||||
foreach ($maps as $map) {
|
||||
if ($rowPair)
|
||||
|
@ -47,7 +53,11 @@ if ($maps !== false) {
|
|||
$rowPair = !$rowPair;
|
||||
$iterator++;
|
||||
|
||||
if (!check_acl ($config["id_user"], $map["group_id"], "IR")) {
|
||||
$is_in_group = in_array($map['group_id'], $own_groups);
|
||||
if (!$is_in_group){
|
||||
continue;
|
||||
}
|
||||
if (!check_acl ($config["id_user"], $map["group_id"], "IR", 0, true)) {
|
||||
continue;
|
||||
}
|
||||
$data = array ();
|
||||
|
|
|
@ -144,11 +144,11 @@ if ($layers != false) {
|
|||
gis_make_layer($layer['layer_name'], $layer['view_layer'], null, $layer['id_tmap_layer']);
|
||||
|
||||
// calling agents_get_group_agents with none to obtain the names in the same case as they are in the DB.
|
||||
$agentNamesByGroup = agents_get_group_agents($layer['tgrupo_id_grupo'],false,'none', true);
|
||||
$agentNamesByGroup = agents_get_group_agents($layer['tgrupo_id_grupo'],false,'none', true, true, false);
|
||||
$agentNamesByLayer = gis_get_agents_layer($layer['id_tmap_layer'], array('nombre'));
|
||||
|
||||
$agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer);
|
||||
|
||||
|
||||
foreach ($agentNames as $agentName) {
|
||||
$idAgent = agents_get_agent_id($agentName);
|
||||
$coords = gis_get_data_last_position_agent($idAgent);
|
||||
|
|
|
@ -78,7 +78,17 @@ if (check_acl ($config['id_user'], 0, "AR")) {
|
|||
}
|
||||
$id = (int) get_parameter ('id', -1);
|
||||
|
||||
$own_info = get_user_info ($config['id_user']);
|
||||
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
||||
$own_groups = array_keys(users_get_groups($config['id_user'], "IR"));
|
||||
else
|
||||
$own_groups = array_keys(users_get_groups($config['id_user'], "IR", false));
|
||||
|
||||
foreach ($gisMaps as $gisMap) {
|
||||
$is_in_group = in_array($gisMap['group_id'], $own_groups);
|
||||
if (!$is_in_group){
|
||||
continue;
|
||||
}
|
||||
if (! check_acl ($config["id_user"], $gisMap["group_id"], "IR")) {
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue