RemoteAdmin:admin exists user

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Created page with "'''admin_exists_user''' remotely allows to check if a certain user account exists === Enabling admin_exists_user === If not all functions are enabled, use admin_exists_user to ...")
 
m
 
(5 intermediate revisions by 2 users not shown)
Line 41: Line 41:
 
! Description
 
! Description
 
! Values
 
! Values
 +
|-
 +
| ''success''
 +
| true when successfull
 +
| true, false
 
|-
 
|-
 
| ''user_firstname''
 
| ''user_firstname''
Line 52: Line 56:
 
|''lastlogin''
 
|''lastlogin''
 
| timestamp of last user login  
 
| timestamp of last user login  
|
+
| This is a Unix timestamp.  This was buggy before OpenSimulator git master f064075 (post 0.7.5) where the timestamp was returned in a timestamp field in lastlogin instead.  If the user did not exist, this value is 0.
 
|}
 
|}
 
  
 
=== Error messages ===
 
=== Error messages ===
 
No error messages.
 
No error messages.
 
  
 
== Notes ==
 
== Notes ==
Line 68: Line 70:
 
<?php
 
<?php
  
// Including the RemoteAdmin PHP class.
+
$request = xmlrpc_encode_request("admin_exists_user", array("password" => "plop", "user_firstname" => "Test", "user_lastname" => "User"));
include('RemoteAdmin.php');
+
  
// Instantiate the class with parameters identical to the Python example above
+
$context = stream_context_create(array('http' => array(
$myRemoteAdmin = new RemoteAdmin('127.0.0.1', 9000, 'secret');
+
    'method' => "POST",
 +
    'header' => "Content-Type: text/xml\r\nconnection: close\r\n",
 +
    'content' => $request
 +
)));
 +
 
 +
$file = file_get_contents("http://localhost:5000", false, $context);
 +
 
 +
$response = xmlrpc_decode($file);
 +
if ($response && xmlrpc_is_fault($response)) {
 +
    trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");
 +
} else {
 +
    print_r($response);
 +
}
  
// Invoke admin_exists_user (multiple parameters)
 
$parameters = array('user_firstname' => 'John', 'user_lastname' => 'Doe');
 
$myRemoteAdmin->SendCommand('admin_exists_user', $parameters);
 
 
?>
 
?>
 
</source>
 
</source>
  
[[Category:Development]]
+
 
 +
[[Category:RemoteAdmin]]
 +
[[Category:RemoteAdmin Commands]]

Latest revision as of 16:27, 24 October 2015

admin_exists_user remotely allows to check if a certain user account exists


Contents

[edit] Enabling admin_exists_user

If not all functions are enabled, use admin_exists_user to enable the function in the [RemoteAdmin] section

enabled_methods = admin_exists_user,...


[edit] Parameters

[edit] Required Parameters

These parameters are required

parameter Description Values
user_firstname first name of user
user_lastname last name of user


[edit] Optional Parameters

No optional parameters.


[edit] Returned Parameters

[edit] Returned Parameters

These parameters are returned by Remote Admin

parameter Description Values
success true when successfull true, false
user_firstname first name of user
user_lastname last name of user
lastlogin timestamp of last user login This is a Unix timestamp. This was buggy before OpenSimulator git master f064075 (post 0.7.5) where the timestamp was returned in a timestamp field in lastlogin instead. If the user did not exist, this value is 0.

[edit] Error messages

No error messages.

[edit] Notes

[edit] Example

[edit] PHP

<?php
 
$request = xmlrpc_encode_request("admin_exists_user", array("password" => "plop", "user_firstname" => "Test", "user_lastname" => "User"));
 
$context = stream_context_create(array('http' => array(
    'method' => "POST",
    'header' => "Content-Type: text/xml\r\nconnection: close\r\n",
    'content' => $request
)));
 
$file = file_get_contents("http://localhost:5000", false, $context);
 
$response = xmlrpc_decode($file);
if ($response && xmlrpc_is_fault($response)) {
    trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");
} else {
    print_r($response);
}
 
?>
Personal tools
General
About This Wiki