summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2015-09-04 22:30:54 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2015-09-04 22:30:54 (GMT)
commitc3bc616a9669b079523e905b6c3177171f19d1df (patch)
tree9ccd906f5e3adfd779cb589f8f433641eb8af6c6 /lib
parent181c5204de2d961e6399e6822d1145a851579848 (diff)
added library function to get fullname
Diffstat (limited to 'lib')
-rwxr-xr-xlib/RHRD/rddb.pm20
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) = @_;