UserManipulation
From OpenSimulator
(→Introduction) |
|||
(17 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__TOC__ | __TOC__ | ||
+ | {{MainPageQuicklinks|UserManipulation}} | ||
=Introduction= | =Introduction= | ||
− | Normally, users are created in OpenSimulator via | + | Normally, users are created in OpenSimulator via the "create user" command on the region console (in standalone configuration) or on the ROBUST service console (in grid configuration). However, users can also be created by making an XMLRPC call directly to the ROBUST service. |
+ | |||
+ | This facility has been available since OpenSimulator 0.7.3. It can currently only be used in grid configuration. On standalone, users can be created via the different create user call on the [[RemoteAdmin]] module. | ||
=Setup= | =Setup= | ||
− | The | + | The listeners for some of the XMLRPC calls on ROBUST has to be explicitly enabled. In the [UserAccountService] section of Robust.ini, set |
[UserAccountService] | [UserAccountService] | ||
AllowCreateUser = true | AllowCreateUser = true | ||
+ | AllowSetAccount = true | ||
− | Please be aware that this will expose the call on the UserAccountServiceConnector as listed in the ServiceConnectiors parameter in the [Startup] section at the top of the file. The default port used (8003) is one that should not be exposed to other users. For logging into OpenSimulator you only need to expose the port that is running the LLLoginServiceInConnector (8002 by default). | + | and in [AuthenicationService] |
+ | |||
+ | [AuthenticationService] | ||
+ | AllowSetPassword = true | ||
+ | |||
+ | '''Please be aware that this will expose the call on the UserAccountServiceConnector and AuthenticationServiceConnector as listed in the ServiceConnectiors parameter in the [Startup] section at the top of the file. The default port used (8003) is one that should not be exposed to other users. For logging into OpenSimulator you only need to expose the port that is running the LLLoginServiceInConnector (8002 by default). | ||
+ | |||
+ | This also means that these facilities should not be enabled on an open grid (one where untrusted third parties can connect simulators) at this time. | ||
+ | |||
+ | ==Default avatar entries== | ||
+ | |||
+ | If you want a new user to have the initial minimal body-part/clothing set (skin, shape, eyes, hair, pants, shirt) required for them to appear as anything other than a gas-cloud then make sure | ||
+ | |||
+ | [UserAccountService] | ||
+ | CreateDefaultAvatarEntries = true | ||
+ | |||
+ | in Robust.ini. This setting will already be true in the Robust.ini.example of OpenSimulator 0.7.4 and later. | ||
=Use= | =Use= | ||
− | + | ==createuser== | |
+ | |||
+ | Here's an example python program to call this. It assumes that your ROBUST services are running on localhost. | ||
− | < | + | <source lang="python"> |
#!/usr/bin/python | #!/usr/bin/python | ||
Line 23: | Line 45: | ||
import urllib | import urllib | ||
− | params = urllib.urlencode({'METHOD':'createuser', 'FirstName':' | + | params = urllib.urlencode({'METHOD':'createuser', 'FirstName':'Jon', 'LastName':'Snow', 'Password':'test', 'PrincipalID':'3a1c8128-908f-4455-8157-66c96a46f75e'}) |
conn = httplib.HTTPConnection("localhost", 8003); | conn = httplib.HTTPConnection("localhost", 8003); | ||
conn.request("POST", "/accounts", params) | conn.request("POST", "/accounts", params) | ||
response = conn.getresponse() | response = conn.getresponse() | ||
print response.read(); | print response.read(); | ||
− | </ | + | </source> |
PrincipalID is the unique ID of the user. | PrincipalID is the unique ID of the user. | ||
Line 34: | Line 56: | ||
If everything goes well, you should get back | If everything goes well, you should get back | ||
− | < | + | <source lang="xml"> |
<?xml version="1.0"?> | <?xml version="1.0"?> | ||
<ServerResponse> | <ServerResponse> | ||
<result type="List"> | <result type="List"> | ||
− | <FirstName> | + | <FirstName>Jon</FirstName> |
− | <LastName> | + | <LastName>Snow</LastName> |
<Email/> | <Email/> | ||
<PrincipalID>3a1c8128-908f-4455-8157-66c96a46f75e</PrincipalID> | <PrincipalID>3a1c8128-908f-4455-8157-66c96a46f75e</PrincipalID> | ||
Line 49: | Line 71: | ||
</result> | </result> | ||
</ServerResponse> | </ServerResponse> | ||
− | </ | + | </source> |
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. | 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. | ||
Line 55: | Line 77: | ||
If the call fails you will get the response | If the call fails you will get the response | ||
− | < | + | <source lang="xml"> |
<?xml version="1.0"?> | <?xml version="1.0"?> | ||
<ServerResponse> | <ServerResponse> | ||
<result>Failure</result> | <result>Failure</result> | ||
</ServerResponse> | </ServerResponse> | ||
− | </ | + | </source> |
+ | |||
+ | ==setaccount== | ||
+ | |||
+ | Here's an example python program to call this. It assumes that your ROBUST services are running on localhost. | ||
+ | |||
+ | <source lang="python"> | ||
+ | #!/usr/bin/python | ||
+ | |||
+ | import httplib | ||
+ | import urllib | ||
+ | |||
+ | params = urllib.urlencode({'METHOD':'setaccount', 'FirstName':'Tyrion', 'PrincipalID':'3a1c8128-908f-4455-8157-66c96a46f75e'}) | ||
+ | conn = httplib.HTTPConnection("localhost", 8003); | ||
+ | conn.request("POST", "/accounts", params) | ||
+ | response = conn.getresponse() | ||
+ | print response.read(); | ||
+ | </source> | ||
+ | |||
+ | PrincipalID is the unique ID of the user. Here, it is used to identify the user that we set up earlier. | ||
+ | |||
+ | If everything goes well, you should get back | ||
+ | |||
+ | <source lang="xml"> | ||
+ | <?xml version="1.0"?> | ||
+ | <ServerResponse> | ||
+ | <result type="List"> | ||
+ | <FirstName>Tyrion</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> | ||
+ | </source> | ||
+ | |||
+ | Note that the first name has now changed from Jon to Tyrion. | ||
+ | |||
+ | If the call fails you will get the response | ||
+ | |||
+ | <source lang="xml"> | ||
+ | <?xml version="1.0"?> | ||
+ | <ServerResponse> | ||
+ | <result>Failure</result> | ||
+ | </ServerResponse> | ||
+ | </source> | ||
+ | |||
+ | ==setpassword== | ||
+ | Changing a password is done through the authentication service rather than the user account service. Unfortunately, the parameters required are slightly different from those used by the user account service. In this case we need to make a call to http://<robust-services-address>/auth/plain with METHOD = setpassword, PRINCIPAL = <principalID> and PASSWORD = <new-password>. Here's an example | ||
+ | |||
+ | <source lang="python"> | ||
+ | #!/usr/bin/python | ||
+ | |||
+ | import httplib | ||
+ | import urllib | ||
+ | |||
+ | params = urllib.urlencode({'METHOD':'setpassword', 'PRINCIPAL' : '3a1c8128-908f-4455-8157-66c96a46f75e', 'PASSWORD':'bing'}) | ||
+ | conn = httplib.HTTPConnection("localhost", 8003); | ||
+ | conn.request("POST", "/auth/plain", params) | ||
+ | response = conn.getresponse() | ||
+ | print response.read(); | ||
+ | </source> | ||
+ | |||
+ | This aims to set Wilma Flintstone's password to bing, identifying her with the PrincipalID we received before. If successful, the call will return | ||
+ | |||
+ | <source lang="xml"> | ||
+ | <?xml version="1.0"?> | ||
+ | <ServerResponse> | ||
+ | <Result>Success</Result> | ||
+ | </ServerResponse> | ||
+ | </source> | ||
+ | |||
+ | On failure, | ||
+ | |||
+ | <source lang="xml"> | ||
+ | <?xml version="1.0"?> | ||
+ | <ServerResponse> | ||
+ | <Result>Failure</Result> | ||
+ | </ServerResponse> | ||
+ | </source> | ||
+ | |||
+ | ==Delete a user== | ||
+ | This is probably not currently possible. Or rather, nobody has done it and reported back whether everything still works or whether there are lots of issues. | ||
+ | |||
+ | The normal way to 'delete' a user is to set their UserLevel to -1. This will prevent them from logging in. | ||
+ | |||
+ | If you need to create a user with the same name, then first rename the deleted user (e.g. to Wilma Flintstone_<RANDOM-UUID>) before creating one with the old name. |
Latest revision as of 06:43, 6 April 2022
Contents |
Languages: |
English Deutsch |
[edit] Introduction
Normally, users are created in OpenSimulator via the "create user" command on the region console (in standalone configuration) or on the ROBUST service console (in grid configuration). However, users can also be created by making an XMLRPC call directly to the ROBUST service.
This facility has been available since OpenSimulator 0.7.3. It can currently only be used in grid configuration. On standalone, users can be created via the different create user call on the RemoteAdmin module.
[edit] Setup
The listeners for some of the XMLRPC calls on ROBUST has to be explicitly enabled. In the [UserAccountService] section of Robust.ini, set
[UserAccountService] AllowCreateUser = true AllowSetAccount = true
and in [AuthenicationService]
[AuthenticationService] AllowSetPassword = true
Please be aware that this will expose the call on the UserAccountServiceConnector and AuthenticationServiceConnector as listed in the ServiceConnectiors parameter in the [Startup] section at the top of the file. The default port used (8003) is one that should not be exposed to other users. For logging into OpenSimulator you only need to expose the port that is running the LLLoginServiceInConnector (8002 by default).
This also means that these facilities should not be enabled on an open grid (one where untrusted third parties can connect simulators) at this time.
[edit] Default avatar entries
If you want a new user to have the initial minimal body-part/clothing set (skin, shape, eyes, hair, pants, shirt) required for them to appear as anything other than a gas-cloud then make sure
[UserAccountService] CreateDefaultAvatarEntries = true
in Robust.ini. This setting will already be true in the Robust.ini.example of OpenSimulator 0.7.4 and later.
[edit] Use
[edit] createuser
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>
[edit] setaccount
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':'setaccount', 'FirstName':'Tyrion', '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. Here, it is used to identify the user that we set up earlier.
If everything goes well, you should get back
<?xml version="1.0"?> <ServerResponse> <result type="List"> <FirstName>Tyrion</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>
Note that the first name has now changed from Jon to Tyrion.
If the call fails you will get the response
<?xml version="1.0"?> <ServerResponse> <result>Failure</result> </ServerResponse>
[edit] setpassword
Changing a password is done through the authentication service rather than the user account service. Unfortunately, the parameters required are slightly different from those used by the user account service. In this case we need to make a call to http://<robust-services-address>/auth/plain with METHOD = setpassword, PRINCIPAL = <principalID> and PASSWORD = <new-password>. Here's an example
#!/usr/bin/python import httplib import urllib params = urllib.urlencode({'METHOD':'setpassword', 'PRINCIPAL' : '3a1c8128-908f-4455-8157-66c96a46f75e', 'PASSWORD':'bing'}) conn = httplib.HTTPConnection("localhost", 8003); conn.request("POST", "/auth/plain", params) response = conn.getresponse() print response.read();
This aims to set Wilma Flintstone's password to bing, identifying her with the PrincipalID we received before. If successful, the call will return
<?xml version="1.0"?> <ServerResponse> <Result>Success</Result> </ServerResponse>
On failure,
<?xml version="1.0"?> <ServerResponse> <Result>Failure</Result> </ServerResponse>
[edit] Delete a user
This is probably not currently possible. Or rather, nobody has done it and reported back whether everything still works or whether there are lots of issues.
The normal way to 'delete' a user is to set their UserLevel to -1. This will prevent them from logging in.
If you need to create a user with the same name, then first rename the deleted user (e.g. to Wilma Flintstone_<RANDOM-UUID>) before creating one with the old name.