Merge branch 'ent-6804-buscador-pandora-permite-acceder-politicas-open' into 'develop'

Ent 6804 buscador pandora permite acceder politicas open

Closes pandora_enterprise#6804

See merge request artica/pandorafms!3688
This commit is contained in:
Daniel Rodriguez 2020-12-17 17:05:26 +01:00
commit 2591d8874a
2 changed files with 40 additions and 14 deletions

View File

@ -1,15 +1,17 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/**
* Pandora FMS - http://pandorafms.com
* ==================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
require_once 'include/functions_messages.php';
require_once 'include/functions_servers.php';
require_once 'include/functions_notifications.php';
@ -142,7 +144,7 @@ if ($config['menu_type'] == 'classic') {
}
if ($_GET['sec'] == 'main' || !isset($_GET['sec'])) {
// home screen chosen by the user
// Home screen chosen by the user.
$home_page = '';
if (isset($config['id_user'])) {
$user_info = users_get_user_by_id($config['id_user']);
@ -169,6 +171,7 @@ if ($config['menu_type'] == 'classic') {
break;
case 'Default':
default:
$_GET['sec2'] = 'general/logon_ok';
break;
@ -763,6 +766,7 @@ if ($config['menu_type'] == 'classic') {
page: 'include/ajax/order_interpreter',
method: 'getResult',
text: $('#keywords').val(),
enterprise: <?php echo (int) enterprise_installed(); ?>,
},
success: function (data) {
$('#result_order').html(data);

View File

@ -380,7 +380,7 @@ class OrderInterpreter extends Wizard
// Take value from input search.
$text = get_parameter('text', '');
$array_found = [];
$enterprise = (bool) get_parameter('enterprise', false);
$iterator = 0;
$more_results = 0;
@ -394,7 +394,7 @@ class OrderInterpreter extends Wizard
__('GO TO '.$value['name'])
) && $value['acl']
) {
if ($iterator <= 9) {
if ($iterator <= 9 && $this->canShowItem($enterprise, $this->pages_menu[$key]['url'])) {
echo '<li class="list_found" name="'.$iterator.'" id="'.$iterator.'">';
echo '
Go to &nbsp;
@ -432,6 +432,28 @@ class OrderInterpreter extends Wizard
}
/**
* Determines if the element must be shown or not.
*
* @param boolean $isEnterprise Define if the console is Enterprise.
* @param string $url Url of the element for select.
*
* @return boolean
*/
private function canShowItem(bool $isEnterprise, string $url)
{
$canShow = false;
$hasEnterpriseLocation = strpos($url, '&sec2=enterprise') !== false;
if (($isEnterprise === false && $hasEnterpriseLocation === false) || $isEnterprise === true) {
$canShow = true;
}
return $canShow;
}
/**
* Load JS content.
* function to create JS actions.