diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-07-25 20:40:04 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-07-25 20:40:33 (GMT) |
commit | 53f3a59216455a5aa3208191be76782eba246ba1 (patch) | |
tree | 539e2b53d2d9d976d6cc075853941ff253daf626 /lib/RHRD/rddb.pm | |
parent | df6717fea5d717e3ed3a27612339b9b80930abca (diff) |
implemented command to list groups of user
Diffstat (limited to 'lib/RHRD/rddb.pm')
-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 |