diff options
Diffstat (limited to 'share/perl/lib/OpenSim/UserServer')
-rw-r--r-- | share/perl/lib/OpenSim/UserServer/Config.pm | 125 | ||||
-rw-r--r-- | share/perl/lib/OpenSim/UserServer/UserManager.pm | 49 |
2 files changed, 174 insertions, 0 deletions
diff --git a/share/perl/lib/OpenSim/UserServer/Config.pm b/share/perl/lib/OpenSim/UserServer/Config.pm new file mode 100644 index 0000000..da628ed --- /dev/null +++ b/share/perl/lib/OpenSim/UserServer/Config.pm | |||
@@ -0,0 +1,125 @@ | |||
1 | package OpenSim::UserServer::Config; | ||
2 | |||
3 | use strict; | ||
4 | |||
5 | our %SYS_SQL = ( | ||
6 | select_user_by_name => | ||
7 | "select * from users where username=? and lastname=?", | ||
8 | select_user_by_uuid => | ||
9 | "select * from users where uuid=?", | ||
10 | create_user => | ||
11 | "insert into users values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", | ||
12 | ); | ||
13 | |||
14 | our @USERS_COLUMNS = ( | ||
15 | "UUID", | ||
16 | "username", | ||
17 | "lastname", | ||
18 | "passwordHash", | ||
19 | "passwordSalt", | ||
20 | "homeRegion", | ||
21 | "homeLocationX", | ||
22 | "homeLocationY", | ||
23 | "homeLocationZ", | ||
24 | "homeLookAtX", | ||
25 | "homeLookAtY", | ||
26 | "homeLookAtZ", | ||
27 | "created", | ||
28 | "lastLogin", | ||
29 | "userInventoryURI", | ||
30 | "userAssetURI", | ||
31 | "profileCanDoMask", | ||
32 | "profileWantDoMask", | ||
33 | "profileAboutText", | ||
34 | "profileFirstText", | ||
35 | "profileImage", | ||
36 | "profileFirstImage", | ||
37 | ); | ||
38 | |||
39 | # copied from opensim | ||
40 | our @classified_categories = ( | ||
41 | { category_id => 1, category_name => "Shopping" }, | ||
42 | { category_id => 2, category_name => "Land Rental" }, | ||
43 | { category_id => 3, category_name => "Property Rental" }, | ||
44 | { category_id => 4, category_name => "Special Attraction" }, | ||
45 | { category_id => 5, category_name => "New Products" }, | ||
46 | { category_id => 6, category_name => "Employment" }, | ||
47 | { category_id => 7, category_name => "Wanted" }, | ||
48 | { category_id => 8, category_name => "Service" }, | ||
49 | { category_id => 9, category_name => "Personal" }, | ||
50 | ); | ||
51 | |||
52 | our @event_categories = (); | ||
53 | our @event_notifications = (); | ||
54 | our @gestures =(); | ||
55 | our @global_textures = ( | ||
56 | { | ||
57 | cloud_texture_id => "dc4b9f0b-d008-45c6-96a4-01dd947ac621", | ||
58 | moon_texture_id => "ec4b9f0b-d008-45c6-96a4-01dd947ac621", | ||
59 | sun_texture_id => "cce0f112-878f-4586-a2e2-a8f104bba271", | ||
60 | }, | ||
61 | ); | ||
62 | our @initial_outfit = ( | ||
63 | { folder_name => "Nightclub Female", gender => "female" } | ||
64 | ); | ||
65 | our @inventory_lib_owner = ({ agent_id => "11111111-1111-0000-0000-000100bba000" }); | ||
66 | our @inventory_lib_root = ({ folder_id => "00000112-000f-0000-0000-000100bba000" }); | ||
67 | our @inventory_root = ({ folder_id => "2eb27bc2-22ee-48db-b2e9-5c79a6582919" }); | ||
68 | our @inventory_skel_lib = ( | ||
69 | { | ||
70 | folder_id => "00000112-000f-0000-0000-000100bba000", | ||
71 | name => "OpenSim Library", | ||
72 | parent_id => "00000000-0000-0000-0000-000000000000", | ||
73 | type_default => -1, | ||
74 | version => 1, | ||
75 | }, | ||
76 | { | ||
77 | folder_id => "00000112-000f-0000-0000-000100bba001", | ||
78 | name => "Texture Library", | ||
79 | parent_id => "00000112-000f-0000-0000-000100bba000", | ||
80 | type_default => -1, | ||
81 | version => 1, | ||
82 | }, | ||
83 | ); | ||
84 | our @inventory_skeleton = ( | ||
85 | { | ||
86 | folder_id => "2eb27bc2-22ee-48db-b2e9-5c79a6582919", | ||
87 | name => "My Inventory", | ||
88 | parent_id => "00000000-0000-0000-0000-000000000000", | ||
89 | type_default => 8, | ||
90 | version => 1, | ||
91 | }, | ||
92 | { | ||
93 | folder_id => "6cc20d86-9945-4997-a102-959348d56821", | ||
94 | name => "Textures", | ||
95 | parent_id => "2eb27bc2-22ee-48db-b2e9-5c79a6582919", | ||
96 | type_default => 0, | ||
97 | version => 1, | ||
98 | }, | ||
99 | { | ||
100 | folder_id => "840b747f-bb7d-465e-ab5a-58badc953484", | ||
101 | name => "Clothes", | ||
102 | parent_id => "2eb27bc2-22ee-48db-b2e9-5c79a6582919", | ||
103 | type_default => 5, | ||
104 | version => 1, | ||
105 | }, | ||
106 | { | ||
107 | folder_id => "37039005-7bbe-42a2-aa12-6bda453f37fd", | ||
108 | name => "Objects", | ||
109 | parent_id => "2eb27bc2-22ee-48db-b2e9-5c79a6582919", | ||
110 | type_default => 6, | ||
111 | version => 1, | ||
112 | }, | ||
113 | ); | ||
114 | our @login_flags = ( | ||
115 | { | ||
116 | daylight_savings => "N", | ||
117 | ever_logged_in => "Y", | ||
118 | gendered => "Y", | ||
119 | stipend_since_login => "N", | ||
120 | }, | ||
121 | ); | ||
122 | our @ui_config = ({ allow_first_life => "Y" }); | ||
123 | |||
124 | 1; | ||
125 | |||
diff --git a/share/perl/lib/OpenSim/UserServer/UserManager.pm b/share/perl/lib/OpenSim/UserServer/UserManager.pm new file mode 100644 index 0000000..ce35329 --- /dev/null +++ b/share/perl/lib/OpenSim/UserServer/UserManager.pm | |||
@@ -0,0 +1,49 @@ | |||
1 | package OpenSim::UserServer::UserManager; | ||
2 | |||
3 | use strict; | ||
4 | use Carp; | ||
5 | use OpenSim::Utility; | ||
6 | use OpenSim::UserServer::Config; | ||
7 | |||
8 | sub getUserByName { | ||
9 | my ($first, $last) = @_; | ||
10 | my $res = &OpenSim::Utility::getSimpleResult($OpenSim::UserServer::Config::SYS_SQL{select_user_by_name}, $first, $last); | ||
11 | my $count = @$res; | ||
12 | my %user = (); | ||
13 | if ($count == 1) { | ||
14 | my $user_row = $res->[0]; | ||
15 | foreach (@OpenSim::UserServer::Config::USERS_COLUMNS) { | ||
16 | $user{$_} = $user_row->{$_} || ""; | ||
17 | } | ||
18 | } else { | ||
19 | Carp::croak("user not found"); | ||
20 | } | ||
21 | return \%user; | ||
22 | } | ||
23 | |||
24 | sub getUserByUUID { | ||
25 | my ($uuid) = @_; | ||
26 | my $res = &OpenSim::Utility::getSimpleResult($OpenSim::UserServer::Config::SYS_SQL{select_user_by_uuid}, $uuid); | ||
27 | my $count = @$res; | ||
28 | my %user = (); | ||
29 | if ($count == 1) { | ||
30 | my $user_row = $res->[0]; | ||
31 | foreach (@OpenSim::UserServer::Config::USERS_COLUMNS) { | ||
32 | $user{$_} = $user_row->{$_} || ""; | ||
33 | } | ||
34 | } else { | ||
35 | Carp::croak("user not found"); | ||
36 | } | ||
37 | return \%user; | ||
38 | } | ||
39 | |||
40 | sub createUser { | ||
41 | my $user = shift; | ||
42 | my @params = (); | ||
43 | foreach (@OpenSim::UserServer::Config::USERS_COLUMNS) { | ||
44 | push @params, $user->{$_}; | ||
45 | } | ||
46 | my $res = &OpenSim::Utility::getSimpleResult($OpenSim::UserServer::Config::SYS_SQL{create_user}, @params); | ||
47 | } | ||
48 | |||
49 | 1; | ||