Jump to content

OpenSimulator Internals/Connector Architecture/UserAccount Connector

From Open Simulator Technical Help

OpenSimulator Internals/Connector Architecture/UserAccount Connector

[edit]

Overview

[edit]

UserAccountServicesConnector is the simulator-side remote connector for IUserAccountService. It translates IUserAccountService calls into HTTP POST requests to the ROBUST UserAccount handler at /accounts.

Source file:

OpenSim/Services/Connectors/UserAccountServicesConnector.cs

Initialisation

[edit]

Config section: [UserAccountService]

Required key:

  • UserAccountServerURI -- URL of the ROBUST UserAccount endpoint; throws if missing or unresolvable

Base class BaseServiceConnector.Initialise() called for auth setup.

Three constructors:

  • Default (no args) -- URI must be set externally
  • String URI -- used by callers that pass the URI directly
  • IConfigSource -- calls Initialise(), normal grid mode

Transport

[edit]

All methods POST to m_ServerURI + "/accounts" using SynchronousRestFormsRequester.

All requests include:

  • VERSIONMIN / VERSIONMAX -- protocol version negotiation
  • METHOD -- identifies the operation

Two internal helpers:

SendAndGetReply() -- used by single-account GET methods and StoreUserAccount():

  • POSTs, parses XML response
  • Returns UserAccount constructed from result dictionary, or null

SendAndGetBoolReply() -- defined but not called by any method in this file. Dead code.


Methods

[edit]
Method METHOD field Notes
GetUserAccount(scopeID, firstName, lastName) "getaccount" Lookup by name
GetUserAccount(scopeID, email) "getaccount" Lookup by email
GetUserAccount(scopeID, userID) "getaccount" Lookup by UUID
GetUserAccounts(scopeID, query) "getaccounts" Search by name fragment; returns List<UserAccount>
GetUserAccounts(scopeID, List<string> IDs) "getmultiaccounts" Batch lookup by UUID list; falls back to one-by-one if server returns "Failure"
StoreUserAccount(data) "setaccount" Serializes UserAccount via ToKeyValuePairs(); returns true if result is non-null
CreateUser(first, last, password, email, scopeID) "createuser" Remote user creation; not part of IUserAccountService interface
InvalidateCache(userID) (none) No-op -- cache invalidation not implemented for remote connector
GetUserAccountsWhere(scopeID, where) (none) Always returns null -- not implemented for regions

GetUserAccounts(List<string> IDs) fallback:

  • Tries "getmultiaccounts" first
  • If result == "Failure": sets suported = false, falls back to calling GetUserAccount(scopeID, uuid) one by one
  • Skips IDs that are not valid non-zero UUIDs in the fallback path

Notes

[edit]
  • CreateUser() has a bug: the email field sends first name instead of the email value. The line reads sendData["Email"] = first rather than sendData["Email"] = email.
  • SendAndGetBoolReply() is defined but never called -- dead code.
  • InvalidateCache() is a no-op -- the remote connector has no local cache to invalidate.
  • GetUserAccountsWhere() returns null unconditionally -- SQL WHERE clause queries are not supported over HTTP.
  • ScopeID fields are present in the code but some are commented out.

See Also

[edit]