Server Side Script Sample: CreateUser Script
This is a simple script that acquires the ServerUserDatabase interface and can be used to create and delete users on the server. The sample is constructed to illustrate how to parse and construct property lists and interface with standard Nebulae objects (ServerUserDatabase in this example.)
To test this script your movie can send the following messages to the Nebulae server:
Recipient: system.script.createUser
Content: [#userid:"username", #password:"password", #userlevel: 20]
Recipient: system.script.deleteUser
Content: [#userid:"username"]
The advantage of using the server side approach is to be able to create users when using the SQL database for user authentication, transparently. When used with the standard Nebulae MUSDB these commands will produce results similar to
system.DBAdmin.createUser
system.DBAdmin.deleteUser
Compiling this file will generate one Java Class, CreateUserSample.java. It should be put in a directory listed in the classpath when Nebulae is initialized, in order to be loaded by the Java Virtual Machine. You should also configure the Scriptmap.cfg file to associate the CreateUserSample class with a movie name on your server, for example:
CREATEUSERTEST = CreateUserSample
Download CreateUserSample.java source code
You may utilize this source file to create and compile object code for use within products you may create. THIS CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
|