Merge branch 'ent-2626-pantalla-de-edicion-de-modulos-en-grupos-secundarios' into 'develop'
[Secondary groups] Fixed modules permissions in some views See merge request artica/pandorafms!1669
This commit is contained in:
commit
dc8020dbdc
|
@ -1046,16 +1046,21 @@ class Tree {
|
|||
|
||||
// Modules SQL
|
||||
if ($item_for_count === false) {
|
||||
html_debug("traza", true);
|
||||
//FIXME This group ACL should be the same in all modules view
|
||||
$group_acl = " AND (ta.id_grupo IN ($user_groups_str) OR tasg.id_group IN ($user_groups_str))";
|
||||
$sql = "SELECT $columns
|
||||
FROM tagente_modulo tam
|
||||
INNER JOIN tagente ta
|
||||
ON ta.disabled = 0
|
||||
AND tam.id_agente = ta.id_agente
|
||||
$group_acl
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON tasg.id_agent = ta.id_agente
|
||||
$agent_search_filter
|
||||
$agent_status_filter
|
||||
$module_status_join
|
||||
WHERE tam.disabled = 0
|
||||
$group_acl
|
||||
$module_search_filter
|
||||
GROUP BY tam.nombre
|
||||
ORDER BY $order_fields";
|
||||
|
@ -1634,20 +1639,15 @@ class Tree {
|
|||
// Link to the Module graph
|
||||
|
||||
// ACL
|
||||
$group_id = (int) modules_get_agent_group($module['id']);
|
||||
$all_groups = modules_get_agent_groups($module['id']);
|
||||
$acl_graphs = false;
|
||||
$module["showGraphs"] = 0;
|
||||
|
||||
// Avoid the check on the metaconsole. Too slow to show/hide an icon depending on the permissions
|
||||
if (!empty($group_id) && !is_metaconsole()) {
|
||||
if ($this->strictACL) {
|
||||
$acl_graphs = tags_check_acl_by_module($module['id'], $config['id_user'], 'RR') === true;
|
||||
}
|
||||
else {
|
||||
$acl_graphs = check_acl($config['id_user'], $group_id, "RR");
|
||||
}
|
||||
$acl_graphs = check_acl_one_of_groups($config['id_user'], $all_groups, "RR");
|
||||
}
|
||||
else if (!empty($group_id)) {
|
||||
else if (!empty($all_groups)) {
|
||||
$acl_graphs = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -780,14 +780,14 @@ function modules_get_raw_data($id_agent_module, $date_init, $date_end) {
|
|||
return $data;
|
||||
}
|
||||
|
||||
function modules_get_agent_group($id_agent_module) {
|
||||
function modules_get_agent_groups($id_agent_module) {
|
||||
$return = false;
|
||||
|
||||
$id_agent = modules_get_agentmodule_agent(
|
||||
$id_agent_module);
|
||||
|
||||
if (!empty($id_agent)) {
|
||||
$return = agents_get_agent_group($id_agent);
|
||||
$return = agents_get_all_groups_agent($id_agent);
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
|
|
@ -1184,23 +1184,25 @@ function tags_get_tags_for_module_search($id_user = false, $access = 'AR') {
|
|||
|
||||
function tags_check_acl_by_module($id_module = 0, $id_user = false,
|
||||
$access = 'AW') {
|
||||
|
||||
global $config;
|
||||
|
||||
|
||||
|
||||
$return = false;
|
||||
|
||||
|
||||
if (!empty($id_module)) {
|
||||
$tags = tags_get_module_tags($id_module);
|
||||
$group = modules_get_agent_group($id_module);
|
||||
|
||||
$groups = modules_get_agent_groups($id_module);
|
||||
|
||||
if ($id_user === false) {
|
||||
$id_user = $config["id_user"];
|
||||
}
|
||||
|
||||
$return = tags_check_acl($id_user, $group, $access, $tags, true);
|
||||
|
||||
foreach ($groups as $group) {
|
||||
if (tags_check_acl($id_user, $group, $access, $tags, true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
@ -2480,17 +2482,10 @@ function tags_get_all_user_agents ($id_tag = false, $id_user = false,
|
|||
}
|
||||
|
||||
$select_fields = implode(',',$fields);
|
||||
|
||||
|
||||
$groups_clause = "";
|
||||
if ($strict_user) {
|
||||
if (!empty($groups_and_tags)) {
|
||||
$groups_clause = " AND ".tags_get_acl_tags_module_condition($groups_and_tags, "tagente_modulo");
|
||||
}
|
||||
}
|
||||
else {
|
||||
$groups_clause = " AND tagente.id_grupo IN (".implode(',', array_keys($groups_and_tags)).")";
|
||||
}
|
||||
|
||||
$groups_clause = " AND tagente.id_grupo IN (".implode(',', array_keys($groups_and_tags)).")";
|
||||
|
||||
if (!empty($filter['id_group'])) {
|
||||
if (is_array($filter['id_group']))
|
||||
$groups_str = implode(",", $filter['id_group']);
|
||||
|
|
|
@ -1036,7 +1036,8 @@ if (!empty($result)) {
|
|||
|
||||
|
||||
$data[2] = html_print_image('images/' . modules_show_icon_type ($row['module_type']), true);
|
||||
if (check_acl ($config['id_user'], $row['id_group'], 'AW')) {
|
||||
$agent_groups = agents_get_all_groups_agent($row['id_agent'], $row['id_group']);
|
||||
if (check_acl_one_of_groups ($config['id_user'], $agent_groups, 'AW')) {
|
||||
$show_edit_icon = true;
|
||||
if (defined('METACONSOLE')) {
|
||||
if (!can_user_access_node ()) {
|
||||
|
|
|
@ -866,7 +866,6 @@ else {
|
|||
if ($allow_action) {
|
||||
|
||||
echo '<div style="width:' . $table->width . ';" class="action-buttons">';
|
||||
//~ if (!$readonly && tags_check_acl ($config["id_user"], 0, "EW", $event['clean_tags']) == 1) {
|
||||
if (!$readonly && $show_validate_button) {
|
||||
html_print_button(__('In progress selected'), 'validate_button', false, 'validate_selected(2);', 'class="sub ok"');
|
||||
echo " ";
|
||||
|
@ -884,7 +883,6 @@ else {
|
|||
</script>
|
||||
<?php
|
||||
}
|
||||
//~ if (!$readonly && tags_check_acl ($config["id_user"], 0,"EM", $event['clean_tags']) == 1) {
|
||||
if (!$readonly && ($show_delete_button)) {
|
||||
html_print_button(__('Delete selected'), 'delete_button', false, 'delete_selected();', 'class="sub delete"');
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue