diff options
-rwxr-xr-x | lib/RHRD/rddb.pm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm index c535576..ef7740d 100755 --- a/lib/RHRD/rddb.pm +++ b/lib/RHRD/rddb.pm @@ -209,6 +209,26 @@ sub check_user return (0, 'OK', "user '" . $username . "' not known by rivendell"); } +sub get_fullname +{ + my ($dbh, $username) = @_; + + my $sql = qq{select FULL_NAME from USERS where LOGIN_NAME = ?;}; + my $sth = $dbh->prepare($sql) + or return (undef, 'ERROR', "Database Error: " . $dbh->errstr); + + $sth->execute($username) + or return (undef, 'ERROR', "Database Error: " . $sth->errstr); + + my ($fullname) = $sth->fetchrow_array; + $sth->finish(); + + unless(defined $fullname) { + return (undef, 'ERROR', "user '" . $username . "' not known by rivendell") + } + return ($fullname, 'OK', 'success'); +} + sub get_users { my ($dbh) = @_; |