UserAccountService

From OpenSimulator

Revision as of 17:54, 31 October 2012 by Justincc (Talk | contribs)

Jump to: navigation, search

Contents

Introduction

The OpenSimulator user account service stores data such as name, UUID (PrincipalID), UserLevel, etc.data (object items, notecard items, folders, etc.).

This documentation is not complete yet - some more information can be found at UserManipulation.

TODO: Document remaining operations.

API

Not properly documented yet, but some calling information can be found at UserManipulation.

Formats

UserAccount

This has the format

 <account type="List">
   <FirstName>Jon</FirstName>
   <LastName>Snow</LastName>
   <Email/>
   <PrincipalID>12f0e87c-50b1-46c2-892e-facf1ce4a274</PrincipalID>
   <ScopeID>00000000-0000-0000-0000-000000000000</ScopeID>
   <Created>1350088195</Created>
   <UserLevel>0</UserLevel>
   <UserFlags>0</UserFlags>
   <UserTitle/>
   <LocalToGrid>True</LocalToGrid>
   <ServiceURLs>HomeURI*;GatekeeperURI*;InventoryServerURI*;AssetServerURI*;</ServiceURLs>
 </account0>

where

  • FirstName is the user's first name.
  • LastName is the user's last name.
  • Email is the user's e-mail. In this case, no e-mail was set.
  • PrincipalID is the user's UUID.
  • ScopeID is the scope to which this user belongs. Unless you are using the undocumented feature of hosting multiple grids in a single database, this will always be 00000000-0000-0000-0000-000000000000 (UUID.Zero).
  • Created is the Unix timestamp of when the user was created.
  • UserLevel is the level of the user. Different levels are given different permissions in OpenSimulator. Currently, the only levels that are used natively by OpenSimulator are 200, which indicates the user can become a god, 0 which indicates a normal user and a negative number, which normally stops the user from logging in (though the minimum login level can itself be adjusted via the "login level" ROBUST console command or by adjusting MinLoginLevel in the [LoginService] section of Robust.ini
  • UserFlags may be currently unused.
  • UserTitle currently unused.
  • LocalToGrid should be true for all users. May not currently be in use.
  • ServiceURLs service URLs for use by another grid if Hypergrid is turned on and the user goes to another grid.

In cases where multiple accounts can be returned the account element will have an index value appended (e.g. account3 instead of account).

Calls

createuser

This is only available if you have explicitly set

[UserAccountService]
AllowCreateUser = true

in Robust.ini. This can currently only safely be done on closed grids (i.e. where you control all simulators).

Here's an example python program to call this. It assumes that your ROBUST services are running on localhost.

#!/usr/bin/python
 
import httplib
import urllib
 
params = urllib.urlencode({'METHOD':'createuser', 'FirstName':'Jon', 'LastName':'Snow', 'Password':'test', 'PrincipalID':'3a1c8128-908f-4455-8157-66c96a46f75e'})
conn = httplib.HTTPConnection("localhost", 8003);
conn.request("POST", "/accounts", params)
response = conn.getresponse()
print response.read();

PrincipalID is the unique ID of the user.

If everything goes well, you should get back

<?xml version="1.0"?>
<ServerResponse>
  <result type="List">
    <FirstName>Jon</FirstName>
    <LastName>Snow</LastName>
    <Email/>
    <PrincipalID>3a1c8128-908f-4455-8157-66c96a46f75e</PrincipalID>
    <ScopeID>00000000-0000-0000-0000-000000000000</ScopeID>
    <Created>1318974501</Created>
    <UserLevel>0</UserLevel>
    <UserFlags>0</UserFlags>
    <ServiceURLs>HomeURI*;GatekeeperURI*;InventoryServerURI*;AssetServerURI*;</ServiceURLs>
  </result>
</ServerResponse>

Don't worry about ScopeID, this is used for allow multiple grids to co-exist inside a single database. Created is a unix timestamp of the time the user was created. UserLevel determines whether the user is a god (>= 200) or can log in at all (<0). ServiceURLs are HyperGrid related and do not concern us here.

If the call fails you will get the response

<?xml version="1.0"?>
<ServerResponse>
  <result>Failure</result>
</ServerResponse>
Personal tools
General
About This Wiki