Merge branch 'ent-13312-cambios-en-licencia-y-update-manager-para-version-777' into 'develop'
Ent 13312 cambios en licencia y update manager para version 777 See merge request artica/pandorafms!7302
This commit is contained in:
commit
042accbc22
|
@ -121,6 +121,11 @@ foreach ($rows as $row) {
|
|||
$settings->{$row['key']} = $row['value'];
|
||||
}
|
||||
|
||||
if ($settings->customer_key === 'PANDORA-ENTERPRISE-FREE') {
|
||||
$license['limit'] = 50;
|
||||
$license['license_mode'] = 'FREE';
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
var texts = {
|
||||
|
|
|
@ -65,7 +65,7 @@ if (isset($config['lts_updates']) === false) {
|
|||
}
|
||||
|
||||
if (empty($license) === true) {
|
||||
$license = 'PANDORA-FREE';
|
||||
$license = 'PANDORA-ENTERPRISE-FREE';
|
||||
}
|
||||
|
||||
$mode_str = '';
|
||||
|
@ -81,7 +81,7 @@ if ($mode === Manager::MODE_ONLINE) {
|
|||
|
||||
enterprise_include_once('/include/functions_license.php');
|
||||
$license_data = enterprise_hook('license_get_info');
|
||||
if ($license_data !== ENTERPRISE_NOT_HOOK) {
|
||||
if ($license_data !== ENTERPRISE_NOT_HOOK && $license !== 'PANDORA-ENTERPRISE-FREE') {
|
||||
$days_to_expiry = ((strtotime($license_data['expiry_date']) - time()) / (60 * 60 * 24));
|
||||
|
||||
if ((int) $license_data['limit_mode'] === 0) {
|
||||
|
@ -91,7 +91,7 @@ if ($license_data !== ENTERPRISE_NOT_HOOK) {
|
|||
$limit = db_get_value('count(*)', 'tagente_modulo', 'disabled', 0);
|
||||
}
|
||||
|
||||
if ($limit > $license_data['limit']) {
|
||||
if ($limit > ($license_data['limit'] * 1.1)) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'You cannot use update manager %s. You are exceding monitoring limits by %s elements. Please update your license or disable enterprise section by moving enterprise directory to another location and try again.',
|
||||
|
@ -112,20 +112,6 @@ if ($license_data !== ENTERPRISE_NOT_HOOK) {
|
|||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (rtrim($license_data['licensed_to']) === Manager::PANDORA_TRIAL_ISSUER) {
|
||||
$product_name = get_product_name();
|
||||
|
||||
ui_print_info_message(
|
||||
__(
|
||||
'You cannot use update manager %s. This license is a trial license to test all %s features. Please update your license to unlock all %s features.',
|
||||
$mode_str,
|
||||
$product_name,
|
||||
$product_name
|
||||
)
|
||||
);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$license_data = [];
|
||||
$license_data['count_enabled'] = db_get_value(
|
||||
|
|
|
@ -134,8 +134,8 @@ if ($stop_lts_modal === '0') {
|
|||
}],
|
||||
open: function(event, ui) {
|
||||
$(".ui-dialog-titlebar-close").hide();
|
||||
$("div.ui-dialog-buttonset").addClass('flex-rr-sb-important');
|
||||
$("div.ui-dialog-buttonset").append(`
|
||||
$(".ui-dialog-buttonpane").children(":first").addClass('flex-rr-sb-important');
|
||||
$(".ui-dialog-buttonpane").children(":first").append(`
|
||||
<div class="welcome-wizard-buttons">
|
||||
<label class="flex-row-center">
|
||||
<input type="checkbox" id="checkbox-no_show_more" class="welcome-wizard-do-not-show"/>
|
||||
|
|
|
@ -1926,6 +1926,9 @@ class DiscoveryTaskList extends HTML
|
|||
|
||||
// License precheck.
|
||||
$license = enterprise_hook('license_get_info');
|
||||
if (empty($license) === false && license_enterprise_free() === true) {
|
||||
$license['limit'] = 50;
|
||||
}
|
||||
|
||||
if (is_array($license) === true
|
||||
&& $n_agents > ($license['limit'] - $license['count_enabled'])
|
||||
|
|
|
@ -1175,6 +1175,10 @@ class HostDevices extends Wizard
|
|||
|
||||
// License precheck.
|
||||
$license = enterprise_hook('license_get_info');
|
||||
if (empty($license) === false && license_enterprise_free() === true) {
|
||||
$license['limit'] = 50;
|
||||
}
|
||||
|
||||
$n_agents = 0;
|
||||
foreach (explode(',', $this->task['subnet']) as $net) {
|
||||
$mask = explode('/', $net, 2)[1];
|
||||
|
|
|
@ -1081,6 +1081,25 @@ class ConsoleSupervisor
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (license_enterprise_free() === true) {
|
||||
if (isset($config['limit_exceeded']) === true && (int) $config['limit_exceeded'] === 1) {
|
||||
update_config_token('limit_exceeded', 0);
|
||||
|
||||
$message = __('When the limit is exceeded the system automatically deactivates the latest agents and modules exceeding license.');
|
||||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.LICENSE.LIMITED',
|
||||
'title' => __('You have exceeded the limit of the free version'),
|
||||
'message' => $message,
|
||||
'url' => '__url__/index.php?sec=gagente&sec2=godmode/agentes/modificar_agente',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
$license = enterprise_hook('license_get_info');
|
||||
if ($license === ENTERPRISE_NOT_HOOK) {
|
||||
return false;
|
||||
|
|
|
@ -1682,6 +1682,24 @@ function license_free()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the license is PANDORA-ENTERPRISE-FREE.
|
||||
*
|
||||
* @return boolean.
|
||||
*/
|
||||
function license_enterprise_free()
|
||||
{
|
||||
$return = true;
|
||||
|
||||
$pandora_license = db_get_value('value', 'tupdate_settings', '`key`', 'customer_key');
|
||||
if ($pandora_license !== 'PANDORA-ENTERPRISE-FREE') {
|
||||
$return = false;
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO: Document enterprise functions
|
||||
*/
|
||||
|
|
|
@ -435,7 +435,11 @@ function api_get_license($trash1, $trash2, $trash3, $returnType='json')
|
|||
if ($license === ENTERPRISE_NOT_HOOK) {
|
||||
// Not an enterprise environment?
|
||||
if (license_free()) {
|
||||
$license = 'PANDORA_FREE';
|
||||
$license = 'PANDORA-FREE';
|
||||
}
|
||||
|
||||
if (license_enterprise_free() === true) {
|
||||
$license = 'PANDORA-ENTERPRISE-FREE';
|
||||
}
|
||||
|
||||
returnData(
|
||||
|
@ -494,6 +498,10 @@ function api_get_license_remaining(
|
|||
return;
|
||||
}
|
||||
|
||||
if (license_enterprise_free() === true) {
|
||||
$license['limit'] = 50;
|
||||
}
|
||||
|
||||
returnData(
|
||||
$returnType,
|
||||
[
|
||||
|
|
|
@ -900,6 +900,7 @@ if (is_ajax()) {
|
|||
global $config;
|
||||
global $pandora_version;
|
||||
global $build_version;
|
||||
$license = db_get_value_sql('SELECT `value` FROM tupdate_settings WHERE `key` LIKE "customer_key"');
|
||||
$product_name = io_safe_output(get_product_name());
|
||||
$license_expiry_date = substr($config['license_expiry_date'], 0, 4).'/'.substr($config['license_expiry_date'], 4, 2).'/'.substr($config['license_expiry_date'], 6, 2);
|
||||
$license_expired = false;
|
||||
|
@ -908,6 +909,11 @@ if (is_ajax()) {
|
|||
$license_expired = true;
|
||||
}
|
||||
|
||||
$text = (enterprise_installed()) ? 'Enterprise' : 'Community';
|
||||
if ($license === 'PANDORA-ENTERPRISE-FREE') {
|
||||
$text = 'FREE';
|
||||
}
|
||||
|
||||
include_once $config['homedir'].'/include/class/Diagnostics.class.php';
|
||||
$d = new Diagnostics;
|
||||
$db_health = json_decode($d->getDatabaseHealthStatus());
|
||||
|
@ -970,16 +976,18 @@ if (is_ajax()) {
|
|||
</th>
|
||||
<th style="width: 60%; text-align: left; border: 0px;">
|
||||
<h1>'.$product_name.'</h1>
|
||||
<p><span>'.__('Version').' '.$pandora_version.$lts_name.' - '.(enterprise_installed() ? 'Enterprise' : 'Community').'</span></p>
|
||||
<p><span>'.__('Version').' '.$pandora_version.$lts_name.' - '.$text.'</span></p>
|
||||
<p><span>'.__('Current package').'</span> '.$config['current_package'].'</p>
|
||||
<p><span>'.__('MR version').'</span> MR'.$config['MR'].'</p>
|
||||
<p><span>Build</span>'.$build_version.'</p>';
|
||||
if (enterprise_installed() === true) {
|
||||
if (enterprise_installed() === true && $license !== 'PANDORA-ENTERPRISE-FREE') {
|
||||
$dialog .= '<p><span>'.__('Support expires').'</span>'.$license_expiry_date.'</p>';
|
||||
}
|
||||
|
||||
if ($license_expired === false) {
|
||||
$dialog .= '<p>'.__('This system has official support, warranty and official updates.').'</p>';
|
||||
} else if ($license === 'PANDORA-ENTERPRISE-FREE') {
|
||||
$dialog .= '<p><span>'.__('This system has no active support contract.').'</span></p>';
|
||||
} else if (enterprise_installed() === true) {
|
||||
$dialog .= '<p><span>'.__('This system has no active support contract, and has no support, upgrades or warranty.').'</span></p>';
|
||||
$dialog .= '<p><b><a href="https://pandorafms.com/contact/" target="_blank">'.__('Contact Pandora FMS for expand your support contract.').'</a></b></p>';
|
||||
|
@ -1280,6 +1288,7 @@ if (is_ajax()) {
|
|||
global $config;
|
||||
global $pandora_version;
|
||||
global $build_version;
|
||||
$license = db_get_value_sql('SELECT `value` FROM tupdate_settings WHERE `key` LIKE "customer_key"');
|
||||
$product_name = io_safe_output(get_product_name());
|
||||
$license_expiry_date = substr($config['license_expiry_date'], 0, 4).'/'.substr($config['license_expiry_date'], 4, 2).'/'.substr($config['license_expiry_date'], 6, 2);
|
||||
$license_expired = false;
|
||||
|
@ -1288,6 +1297,11 @@ if (is_ajax()) {
|
|||
$license_expired = true;
|
||||
}
|
||||
|
||||
$text = (enterprise_installed()) ? 'Enterprise' : 'Community';
|
||||
if ($license === 'PANDORA-ENTERPRISE-FREE') {
|
||||
$text = 'FREE';
|
||||
}
|
||||
|
||||
$lts_name = '';
|
||||
if (empty($config['lts_name']) === false) {
|
||||
$lts_name = ' <i>'.$config['lts_name'].'</i>';
|
||||
|
@ -1313,15 +1327,17 @@ if (is_ajax()) {
|
|||
</th>
|
||||
<th style="width: 60%; text-align: left; border: 0px;">
|
||||
<h1>'.$product_name.'</h1>
|
||||
<p><span>'.__('Version').' '.$pandora_version.$lts_name.' - '.(enterprise_installed() ? 'Enterprise' : 'Community').'</span></p>
|
||||
<p><span>'.__('Version').' '.$pandora_version.$lts_name.' - '.$text.'</span></p>
|
||||
<p><span>'.__('MR version').'</span> MR'.$config['MR'].'</p>
|
||||
<p><span>Build</span>'.$build_version.'</p>';
|
||||
if (enterprise_installed() === true) {
|
||||
if (enterprise_installed() === true && $license !== 'PANDORA-ENTERPRISE-FREE') {
|
||||
$dialog .= '<p><span>'.__('Support expires').'</span>'.$license_expiry_date.'</p>';
|
||||
}
|
||||
|
||||
if ($license_expired === false) {
|
||||
$dialog .= '<p>'.__('This system has official support, warranty and official updates.').'</p>';
|
||||
} else if ($license === 'PANDORA-ENTERPRISE-FREE') {
|
||||
$dialog .= '<p><span>'.__('This system has no active support contract.').'</span></p>';
|
||||
} else if (enterprise_installed() === true) {
|
||||
$dialog .= '<p><span>'.__('This system has no active support contract, and has no support, upgrades or warranty.').'</span></p>';
|
||||
$dialog .= '<p><b><a href="https://pandorafms.com/contact/" target="_blank">'.__('Contact Pandora FMS for expand your support contract.').'</a></b></p>';
|
||||
|
|
|
@ -176,6 +176,8 @@ $(document).ready(function() {
|
|||
|
||||
if (typeof hide_counter == "undefined") hide_counter = 0;
|
||||
|
||||
if (typeof remaining == "undefined") remaining = 30;
|
||||
|
||||
let height = 300;
|
||||
if (typeof invalid_license != "undefined") height = 350;
|
||||
|
||||
|
@ -194,8 +196,6 @@ $(document).ready(function() {
|
|||
},
|
||||
open: function() {
|
||||
if (hide_counter != 1) {
|
||||
var remaining = 30;
|
||||
|
||||
// Timeout counter.
|
||||
var count = function() {
|
||||
if (remaining > 0) {
|
||||
|
@ -246,6 +246,66 @@ $(document).ready(function() {
|
|||
});
|
||||
}
|
||||
|
||||
if ($("#register_dialog_message").length) {
|
||||
function validateEmail(email) {
|
||||
const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||
return re.test(String(email).toLowerCase());
|
||||
}
|
||||
|
||||
$("#register_dialog_message").dialog({
|
||||
dialogClass: "no-close",
|
||||
closeOnEscape: false,
|
||||
resizable: false,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: "auto",
|
||||
width: 800,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
|
||||
$("#button-register_buttom").click(function() {
|
||||
if (validateEmail($("#text-license_email").val())) {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: $("#hidden-test").val(),
|
||||
dataType: "json",
|
||||
data: {
|
||||
page: "enterprise/load_enterprise",
|
||||
register_email: 1,
|
||||
email: $("#text-license_email").val()
|
||||
},
|
||||
success: function(data) {
|
||||
if (data.error != null) {
|
||||
$("#register_dialog_result").addClass("error");
|
||||
$("#register_dialog_result_content").html("Unsuccessful register. "+ data.error);
|
||||
} else {
|
||||
$("#register_dialog_result_content").html("Successfully registered with UID: " + data.result);
|
||||
}
|
||||
|
||||
$("#register_dialog_result").dialog({
|
||||
buttons: [
|
||||
{
|
||||
text: "OK",
|
||||
class: "submit-next",
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
$("#register_dialog_message").dialog("close");
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$("#text-license_email").css("border", "1px solid red");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if ($("#msg_change_password").length) {
|
||||
$("#msg_change_password").dialog({
|
||||
resizable: false,
|
||||
|
|
|
@ -9786,6 +9786,12 @@ div.stat-win-spinner img {
|
|||
min-height: 350px !important;
|
||||
}
|
||||
|
||||
p.license_p {
|
||||
font-size: 12pt;
|
||||
margin-left: 50px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.select2-container--default
|
||||
.select2-selection--multiple
|
||||
.select2-selection__rendered {
|
||||
|
|
|
@ -1219,7 +1219,7 @@ INSERT INTO `ttag` VALUES (1,'network','Network equipment','http://pandoraf
|
|||
|
||||
INSERT INTO `tevent_response` VALUES (1,'Ping to host','Ping to the agent host','ping -c 5 _agent_address_','command',0,620,500,0,'',0,90,0),(5,'Restart agent','Restart the agent with using UDP protocol.

To use this response is necessary to have installed Pandora FMS server and console in the same machine.','/usr/share/pandora_server/util/udp_client.pl _agent_address_ 41122 "REFRESH AGENT"','command',0,620,500,0,'',0,90,0),(6,'Ping to module agent host','Ping to the module agent host','ping -c 5 _module_address_','command',0,620,500,0,'',0,90,0),(7,'Create ticket in Pandora ITSM from event','Create a ticket in Pandora ITSM from an event','index.php?sec=manageTickets&sec2=operation/ITSM/itsm&operation=edit&from_event=_event_id_','url',0,0,0,1,'',0,90,1);
|
||||
|
||||
INSERT INTO `tupdate_settings` VALUES ('current_update', '412'), ('customer_key', 'PANDORA-FREE'), ('updating_binary_path', 'Path where the updated binary files will be stored'), ('updating_code_path', 'Path where the updated code is stored'), ('dbname', ''), ('dbhost', ''), ('dbpass', ''), ('dbuser', ''), ('dbport', ''), ('proxy', ''), ('proxy_port', ''), ('proxy_user', ''), ('proxy_pass', '');
|
||||
INSERT INTO `tupdate_settings` VALUES ('current_update', '412'), ('customer_key', 'PANDORA-ENTERPRISE-FREE'), ('updating_binary_path', 'Path where the updated binary files will be stored'), ('updating_code_path', 'Path where the updated code is stored'), ('dbname', ''), ('dbhost', ''), ('dbpass', ''), ('dbuser', ''), ('dbport', ''), ('proxy', ''), ('proxy_port', ''), ('proxy_user', ''), ('proxy_pass', '');
|
||||
|
||||
--
|
||||
-- Dumping data for table `tcollection`
|
||||
|
|
|
@ -654,6 +654,17 @@ class Client
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return license.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getLicense()
|
||||
{
|
||||
return $this->license;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Executes a curl request.
|
||||
*
|
||||
|
|
|
@ -292,21 +292,23 @@ class Manager
|
|||
*/
|
||||
public function register()
|
||||
{
|
||||
View::render(
|
||||
'register',
|
||||
[
|
||||
'version' => $this->umc->getVersion(),
|
||||
'mr' => $this->umc->getMR(),
|
||||
'error' => $this->umc->getLastError(),
|
||||
'asset' => function ($rp) {
|
||||
echo $this->getUrl($rp);
|
||||
},
|
||||
'authCode' => $this->authCode,
|
||||
'ajax' => $this->ajaxUrl,
|
||||
'ajaxPage' => $this->ajaxPage,
|
||||
'mode' => self::MODE_REGISTER,
|
||||
]
|
||||
);
|
||||
if ($this->umc->getLicense() !== 'PANDORA-ENTERPRISE-FREE') {
|
||||
View::render(
|
||||
'register',
|
||||
[
|
||||
'version' => $this->umc->getVersion(),
|
||||
'mr' => $this->umc->getMR(),
|
||||
'error' => $this->umc->getLastError(),
|
||||
'asset' => function ($rp) {
|
||||
echo $this->getUrl($rp);
|
||||
},
|
||||
'authCode' => $this->authCode,
|
||||
'ajax' => $this->ajaxUrl,
|
||||
'ajaxPage' => $this->ajaxPage,
|
||||
'mode' => self::MODE_REGISTER,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -451,6 +451,10 @@ span.warning {
|
|||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.ui-dialog-content.ui-widget-content#register_dialog_message {
|
||||
display: inherit;
|
||||
}
|
||||
/*.ui-dialog-content.ui-widget-content p {
|
||||
font-size: 10pt;
|
||||
word-break: keep-all;
|
||||
|
|
Loading…
Reference in New Issue