RTMP/E

 addAdmin(username:String, password:String [,scope:String]): Object

HTTP

 http://www.example.com:1111/admin/addAdmin?auser=aUsername&apswd=aPassword&user|username=username&pass|password=password[&scope=scope]

Adds an administrator to the system. The administrator can be a server administrator or a virtual host administrator depending on which parameters you pass. If the administrator already exists, this method fails. Otherwise, the administrator is added and the Users.xml file is updated with the new values. (Virtual host administrators are added to the Users.xml file in a specific virtual host folder.)

You must be a server administrator to add server administrators or to add administrators for virtual hosts other than the one currently connected to.

Availability

Flash Communication Server 1.0.

Parameters

user|username

A String indicating the user name of the administrator being added.

pass|password

A String indicating the password of the administrator being added. The password is encoded before it is written to the Users.xml configuration file. If the scope parameter has a virtual host specified, the new administrator is added to the Users.xml file of the virtual host.

aUsername

A String indicating the username of the administrator making the call.

Note: In the RTMP/E call, the username and password of the administrator making the call are passed in the NetConnection.connect() call.

aPassword

A String indicating the password of the administrator making the call.

scope

A String indicating whether the administrator is a server administrator or a virtual host administrator, and for which virtual host. To add a server administrator, specify server. To add an administrator to the virtual host to which you’re connected, omit this parameter. To add a virtual host administrator to a different virtual host, specify the virtual host as adaptor_name/virtual_host_name.

Note: The parameter data types are relevant only for RTMP/E calls.

Returns

RTMP/E

If the call succeeds, the server sends an information object with a level property of status and a code property of NetConnection.Call.Success. If the call fails, the server sends an information object with a level property of error and a code property of NetConnection.Admin.CommandFailed or a more specific value, if available. The information object also includes a timestamp property indicating the date and time the call was made.

HTTP

The call returns XML with the following structure:

 <result>   <level>   <code>   <timestamp>  </result>

The XML elements contain the same information as the Object properties returned in an RTMP/E call.

Note: The timestamp response over HTTP is formatted differently on Windows (9/23/2007 6:16:40 PM) and Linux (Sun 23 Sep 2007 06:16:40 PM IST).

Example

The following three examples show how you can specify parameters in a call to the addAdmin() method over RTMP:

 nc_admin = new NetConnection(); 
 nc_admin.connect("rtmp://localhost:1111/admin", "JLee", "x52z49ab"); 
  
 /* Adds a server administrator named "GLee" with password "boat4907" */ 
 nc_admin.call("addAdmin", new onAddAdmin(), "GLee", "boat4907", "server"); 
  
 /* Adds a virtual host administrator named "ChrisM" with password "tree2981" */ 
 nc_admin.call("addAdmin", new onAddAdmin(), "ChrisM", "tree2981"); 
  
 /* Adds a virtual host administrator "DHong" with password "wate3235" */ 
 /* for vhost tree.oak.com */ 
 nc_admin.call("addAdmin", new onAddAdmin(), "DHong", "wate3235", "_defaultRoot_/¬ tree.oak.com");

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy