From 5a9b08776ac93c32137de3a11e97d6c9e6d57d0a Mon Sep 17 00:00:00 2001 From: ramonn Date: Wed, 26 May 2010 09:54:21 +0000 Subject: [PATCH] 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). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2803 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 5 +++++ pandora_server/lib/PandoraFMS/DB.pm | 11 +++++++++++ 2 files changed, 16 insertions(+) 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. ##########################################################################