blob: ce35329cf6630a42f45537ebd170461e12e76c55 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
package OpenSim::UserServer::UserManager;
use strict;
use Carp;
use OpenSim::Utility;
use OpenSim::UserServer::Config;
sub getUserByName {
my ($first, $last) = @_;
my $res = &OpenSim::Utility::getSimpleResult($OpenSim::UserServer::Config::SYS_SQL{select_user_by_name}, $first, $last);
my $count = @$res;
my %user = ();
if ($count == 1) {
my $user_row = $res->[0];
foreach (@OpenSim::UserServer::Config::USERS_COLUMNS) {
$user{$_} = $user_row->{$_} || "";
}
} else {
Carp::croak("user not found");
}
return \%user;
}
sub getUserByUUID {
my ($uuid) = @_;
my $res = &OpenSim::Utility::getSimpleResult($OpenSim::UserServer::Config::SYS_SQL{select_user_by_uuid}, $uuid);
my $count = @$res;
my %user = ();
if ($count == 1) {
my $user_row = $res->[0];
foreach (@OpenSim::UserServer::Config::USERS_COLUMNS) {
$user{$_} = $user_row->{$_} || "";
}
} else {
Carp::croak("user not found");
}
return \%user;
}
sub createUser {
my $user = shift;
my @params = ();
foreach (@OpenSim::UserServer::Config::USERS_COLUMNS) {
push @params, $user->{$_};
}
my $res = &OpenSim::Utility::getSimpleResult($OpenSim::UserServer::Config::SYS_SQL{create_user}, @params);
}
1;
|