Hide policy edition on centralized management on node

This commit is contained in:
fermin831 2018-07-17 08:51:39 +02:00
parent 9e8126542a
commit 001861b746
2 changed files with 21 additions and 2 deletions

View File

@ -70,7 +70,9 @@ if ($develop_bypass || is_metaconsole()) {
$network_available = 1;
$wmi_available = 1;
$plugin_available = 1;
$prediction_available = 1;
// FIXME when prediction predictions server modules can be configured
// on metaconsole
$prediction_available = is_metaconsole() ? 0 : 1;
}
$modules = array ();
@ -107,7 +109,7 @@ $checked = get_parameter("checked");
if (($policy_page) || (isset($agent))) {
if ($policy_page) {
$show_creation = true;
$show_creation = !is_central_policies_on_node();
}
else {
if (!isset($all_groups)) {

View File

@ -1363,11 +1363,28 @@ function is_metaconsole() {
return (bool) $config['metaconsole'];
}
/**
* @brief Check if there is centralized management in metaconsole environment.
* Usefull to display some policy features on metaconsole.
*
* @return bool
*/
function is_central_policies() {
global $config;
return is_metaconsole() && $config["centralized_management"];
}
/**
* @brief Check if there is centralized management in node environment. Usefull
* to reduce the policy functionallity on nodes.
*
* @return bool
*/
function is_central_policies_on_node() {
global $config;
return (!is_metaconsole()) && $config["centralized_management"];
}
/**
* Checks if current execution is under an AJAX request.
*