Merge branch 'ent-4728-Desactivar-Restart-Map-para-usuarios-sin-permisos' into 'develop'

Ent 4728 desactivar restart map para usuarios sin permisos

See merge request artica/pandorafms!2805
This commit is contained in:
Daniel Rodriguez 2019-11-04 18:45:57 +01:00
commit a1b879d065
2 changed files with 31 additions and 2 deletions

View File

@ -2642,8 +2642,17 @@ class NetworkMap
*/
public function loadMapData()
{
global $config;
$networkmap = $this->map;
// ACL.
$networkmap_write = check_acl(
$config['id_user'],
$networkmap['id_group'],
'MW'
);
$simulate = false;
if (isset($networkmap['__simulated']) === false) {
$networkmap['filter'] = json_decode(
@ -2711,6 +2720,7 @@ class NetworkMap
$output .= 'var networkmap_center = [ '.$networkmap['center_x'].', '.$networkmap['center_y']."];\n";
$output .= 'var networkmap_dimensions = [ '.$networkmap['width'].', '.$networkmap['height']."];\n";
$output .= 'var enterprise_installed = '.((int) enterprise_installed()).";\n";
$output .= 'var networkmap_write = '.$networkmap_write.";\n";
$output .= 'var node_radius = '.$networkmap['filter']['node_radius'].";\n";
$output .= 'var networkmap_holding_area_dimensions = '.json_encode($networkmap['filter']['holding_area']).";\n";
$output .= "var networkmap = {'nodes': [], 'links': []};\n";

View File

@ -14,6 +14,7 @@
/* global holding_area_dimensions */
/* global networkmap_id */
/* global enterprise_installed */
/* global networkmap_write */
/* global force */
/* global layer_graph_nodes */
/* global layer_graph_links */
@ -2087,7 +2088,12 @@ function show_menu(item, data) {
icon: "add_node",
disabled: function() {
if (enterprise_installed) {
return false;
// Check if user can write network maps.
if (networkmap_write) {
return false;
} else {
return true;
}
} else {
return true;
}
@ -2099,6 +2105,14 @@ function show_menu(item, data) {
items_list["center"] = {
name: set_center_menu,
icon: "center",
disabled: function() {
// Check if user can write network maps.
if (networkmap_write) {
return false;
} else {
return true;
}
},
callback: function(key, options) {
set_center(networkmap_id);
}
@ -2136,7 +2150,12 @@ function show_menu(item, data) {
icon: "restart_map",
disabled: function() {
if (enterprise_installed) {
return false;
// Check if user can write network maps.
if (networkmap_write) {
return false;
} else {
return true;
}
} else {
return true;
}