mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
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 `treport_content` ADD COLUMN `status_of_check` TINYTEXT;
|
||||||
|
|
||||||
ALTER TABLE `tservice` ADD COLUMN `enable_horizontal_tree` TINYINT NOT NULL DEFAULT 0;
|
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;
|
COMMIT;
|
||||||
|
@ -246,7 +246,8 @@ INSERT INTO `tmodule_group` VALUES
|
|||||||
(6,'Performance'),
|
(6,'Performance'),
|
||||||
(7,'Database'),
|
(7,'Database'),
|
||||||
(8,'Enviromental'),
|
(8,'Enviromental'),
|
||||||
(9,'Users');
|
(9,'Users'),
|
||||||
|
(10,'Security');
|
||||||
|
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
|
@ -814,14 +814,21 @@ sub get_plugin_id ($$) {
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
## Return module group ID given the module group name.
|
## Return module group ID given the module group name.
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub get_module_group_id ($$) {
|
sub get_module_group_id ($$;$) {
|
||||||
my ($dbh, $module_group_name) = @_;
|
my ($dbh, $module_group_name, $case_insensitve) = @_;
|
||||||
|
|
||||||
|
$case_insensitve = 0 unless defined($case_insensitve);
|
||||||
|
|
||||||
if (!defined($module_group_name) || $module_group_name eq '') {
|
if (!defined($module_group_name) || $module_group_name eq '') {
|
||||||
return 0;
|
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;
|
return defined ($rc) ? $rc : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -812,7 +812,7 @@ sub process_module_data ($$$$$$$$$$) {
|
|||||||
|
|
||||||
# The group name has to be translated to a group ID
|
# The group name has to be translated to a group ID
|
||||||
if (defined $module_conf->{'module_group'}) {
|
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) {
|
if ( $id_group_module >= 0) {
|
||||||
$module_conf->{'id_module_group'} = $id_group_module;
|
$module_conf->{'id_module_group'} = $id_group_module;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user