diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index c8d97b93c0..1c42db753d 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2010-05-26 Ramon Novoa + + * lib/PandoraFMS/DB.pm: Added a function to get the id of a user + profile (needed by pandora_manage.pl). + 2010-05-25 Ramon Novoa * lib/PandoraFMS/DB.pm: Added a function to get the id of an action diff --git a/pandora_server/lib/PandoraFMS/DB.pm b/pandora_server/lib/PandoraFMS/DB.pm index 0ab6cc16df..6f742d3e8b 100644 --- a/pandora_server/lib/PandoraFMS/DB.pm +++ b/pandora_server/lib/PandoraFMS/DB.pm @@ -44,6 +44,7 @@ our @EXPORT = qw( get_module_name get_nc_profile_name get_os_id + get_profile_id get_server_id get_template_id get_template_module_id @@ -210,6 +211,16 @@ sub get_nc_profile_name ($$) { return get_db_value ($dbh, "SELECT * FROM tnetwork_profile WHERE id_np = ?", $nc_id); } +########################################################################## +## Return profile ID given the profile name. +########################################################################## +sub get_profile_id ($$) { + my ($dbh, $profile_name) = @_; + + my $rc = get_db_value ($dbh, "SELECT id_perfil FROM tperfil WHERE name = ?", $profile_name); + return defined ($rc) ? $rc : -1; +} + ########################################################################## ## Return a group's name given its ID. ##########################################################################