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>
|
2011-11-25 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
* include/graphs/functions_gd.php: Fixed rounded corners in progress bar
|
* include/graphs/functions_gd.php: Fixed rounded corners in progress bar
|
||||||
|
|
|
@ -85,9 +85,7 @@ $table->data = array();
|
||||||
|
|
||||||
$defaultMapId = null;
|
$defaultMapId = null;
|
||||||
|
|
||||||
if (!$maps) {
|
if ($maps){
|
||||||
echo '<div class="nf">'.('No maps defined').'</div>';
|
|
||||||
} else {
|
|
||||||
$own_info = get_user_info($config['id_user']);
|
$own_info = get_user_info($config['id_user']);
|
||||||
foreach ($maps as $map) {
|
foreach ($maps as $map) {
|
||||||
if (!check_acl ($config["id_user"], $map["group_id"], "IR")) {
|
if (!check_acl ($config["id_user"], $map["group_id"], "IR")) {
|
||||||
|
@ -113,7 +111,12 @@ if (!$maps) {
|
||||||
array_push ($table_info, $buttons);
|
array_push ($table_info, $buttons);
|
||||||
$table->data[] = $table_info;
|
$table->data[] = $table_info;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty ($table->data)) {
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
} else {
|
||||||
|
echo '<div class="nf">'.('No maps defined').'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
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"]) {
|
switch ($config["dbtype"]) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
|
$limit_sql = '';
|
||||||
if(isset($offset) && isset($limit)) {
|
if(isset($offset) && isset($limit)) {
|
||||||
$limit_sql = " LIMIT $offset, $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 string $case Which case to return the agentname as (lower, upper, none)
|
||||||
* @param boolean $noACL jump the ACL test.
|
* @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 $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
|
* @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;
|
global $config;
|
||||||
|
|
||||||
if (!$noACL) {
|
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');
|
enterprise_include_once ('include/functions_policies.php');
|
||||||
|
|
||||||
$extra_sql = enterprise_hook('policies_get_agents_sql_condition');
|
if ($extra_access){
|
||||||
if ($extra_sql === ENTERPRISE_NOT_HOOK) {
|
$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 = '';
|
$extra_sql = '';
|
||||||
}else if ($extra_sql != '') {
|
|
||||||
$extra_sql .= ' OR ';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($config["dbtype"]) {
|
switch ($config["dbtype"]) {
|
||||||
|
|
|
@ -38,6 +38,12 @@ $table->align[1] = 'center';
|
||||||
$rowPair = true;
|
$rowPair = true;
|
||||||
$iterator = 0;
|
$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) {
|
if ($maps !== false) {
|
||||||
foreach ($maps as $map) {
|
foreach ($maps as $map) {
|
||||||
if ($rowPair)
|
if ($rowPair)
|
||||||
|
@ -47,7 +53,11 @@ if ($maps !== false) {
|
||||||
$rowPair = !$rowPair;
|
$rowPair = !$rowPair;
|
||||||
$iterator++;
|
$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;
|
continue;
|
||||||
}
|
}
|
||||||
$data = array ();
|
$data = array ();
|
||||||
|
|
|
@ -144,7 +144,7 @@ if ($layers != false) {
|
||||||
gis_make_layer($layer['layer_name'], $layer['view_layer'], null, $layer['id_tmap_layer']);
|
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.
|
// 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'));
|
$agentNamesByLayer = gis_get_agents_layer($layer['id_tmap_layer'], array('nombre'));
|
||||||
|
|
||||||
$agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer);
|
$agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer);
|
||||||
|
|
|
@ -78,7 +78,17 @@ if (check_acl ($config['id_user'], 0, "AR")) {
|
||||||
}
|
}
|
||||||
$id = (int) get_parameter ('id', -1);
|
$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) {
|
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")) {
|
if (! check_acl ($config["id_user"], $gisMap["group_id"], "IR")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue