Merge branch 'ent-11848-meter-modulos-de-seguridad-hardening-y-auditoria-con-el-grupo-de-modulos-security' into 'develop'
Case insensitive option for get module id See merge request artica/pandorafms!6551
This commit is contained in:
commit
f0a3b3af63
|
@ -218,5 +218,5 @@ ALTER TABLE `treport_content` ADD COLUMN `ignore_skipped` INT NOT NULL DEFAULT
|
|||
ALTER TABLE `treport_content` ADD COLUMN `status_of_check` TINYTEXT;
|
||||
|
||||
ALTER TABLE `tservice` ADD COLUMN `enable_horizontal_tree` TINYINT NOT NULL DEFAULT 0;
|
||||
|
||||
INSERT INTO tmodule_group (name) SELECT ('Security') WHERE NOT EXISTS (SELECT name FROM tmodule_group WHERE LOWER(name) = 'security');
|
||||
COMMIT;
|
||||
|
|
|
@ -246,7 +246,8 @@ INSERT INTO `tmodule_group` VALUES
|
|||
(6,'Performance'),
|
||||
(7,'Database'),
|
||||
(8,'Enviromental'),
|
||||
(9,'Users');
|
||||
(9,'Users'),
|
||||
(10,'Security');
|
||||
|
||||
UNLOCK TABLES;
|
||||
|
||||
|
|
|
@ -814,14 +814,21 @@ sub get_plugin_id ($$) {
|
|||
##########################################################################
|
||||
## Return module group ID given the module group name.
|
||||
##########################################################################
|
||||
sub get_module_group_id ($$) {
|
||||
my ($dbh, $module_group_name) = @_;
|
||||
sub get_module_group_id ($$;$) {
|
||||
my ($dbh, $module_group_name, $case_insensitve) = @_;
|
||||
|
||||
$case_insensitve = 0 unless defined($case_insensitve);
|
||||
|
||||
if (!defined($module_group_name) || $module_group_name eq '') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
my $rc = get_db_value ($dbh, "SELECT id_mg FROM tmodule_group WHERE name = ?", safe_input($module_group_name));
|
||||
my $rc;
|
||||
if($case_insensitve == 0) {
|
||||
$rc = get_db_value ($dbh, "SELECT id_mg FROM tmodule_group WHERE name = ?", safe_input($module_group_name));
|
||||
} else {
|
||||
$rc = get_db_value ($dbh, "SELECT id_mg FROM tmodule_group WHERE LOWER(name) = ?", lc(safe_input($module_group_name)));
|
||||
}
|
||||
return defined ($rc) ? $rc : -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -812,7 +812,7 @@ sub process_module_data ($$$$$$$$$$) {
|
|||
|
||||
# The group name has to be translated to a group ID
|
||||
if (defined $module_conf->{'module_group'}) {
|
||||
my $id_group_module = get_module_group_id ($dbh, $module_conf->{'module_group'});
|
||||
my $id_group_module = get_module_group_id ($dbh, $module_conf->{'module_group'}, 1);
|
||||
if ( $id_group_module >= 0) {
|
||||
$module_conf->{'id_module_group'} = $id_group_module;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue