diff options
Diffstat (limited to 'lib')
-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 99b4128..bfa31fd 100755 --- a/lib/RHRD/rddb.pm +++ b/lib/RHRD/rddb.pm @@ -547,6 +547,26 @@ sub list_users return @users; } +sub get_user_groups +{ + my ($ctx, $username) = @_; + + my $sql = qq{select GROUP_NAME from USER_PERMS where USER_NAME = ?;}; + my $sth = $ctx->{'dbh'}->prepare($sql) + or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr); + + $sth->execute($username) + or return (undef, 'ERROR', "Database Error: " . $sth->errstr); + + my @groups; + while(my ($user) = $sth->fetchrow_array()) { + push @groups, $user; + } + $sth->finish(); + + return @groups; +} + ########################### GROUP handling ########################### sub add_group |