CompleteFTP's configuration can be modified using Javascript (i.e. JSS). All administration-related tasks involve the Config object returned by the system.getConfig() function.
There are several ways to execute such scripts:
These will be detailed below.
john@Warp:~/tmp$ ssh admin@localhost -p 14983
admin@myserver:/Admin> var userName = "testuser";
admin@myserver:/Admin> var password = "password";
admin@myserver:/Admin> var homePath = "C:\\Temp";
admin@myserver:/Admin> var config = system.getConfig();
IMPORTANT! Changes to the config will not be saved until applyChanges() is called.
admin@myserver:/Admin> var newFolder = config.folders.add("/Home/" + userName, "windows", homePath);
admin@myserver:/Admin> var newUser = config.users.add();
admin@myserver:/Admin> newUser.userName = userName;
admin@myserver:/Admin> newUser.password = password;
admin@myserver:/Admin> newUser.siteMapping[0].homeFolder = newFolder.fullPath;
admin@myserver:/Admin> config.applyChanges();
After repeating steps 1 to 4 from section:
var userName = "testuser";
var password = "password";
var homePath = "C:\\Temp";
var config = system.getConfig();
IMPORTANT! Changes to the config will not be saved until applyChanges() is called.
var newFolder = config.folders.add("/Home/" + userName, "windows", homePath);
var newUser = config.users.add();
newUser.userName = userName;
newUser.password = password;
newUser.siteMapping[0].homeFolder = newFolder.fullPath;
config.applyChanges();
Note that all the constructs of EC3-level Javascript may be used.
john@Warp:~/tmp$ ssh admin@localhost -p 14983 < adduser.jss
function CustomAddUser(userName, password, homePath) {
// get configuration
var config = system.getConfig();
// create the home folder
var newFolder = config.folders.add("/Home/" + userName, "windows", homePath);
// create a new user
var newUser = config.users.add();
newUser.userName = userName;
newUser.password = password;
newUser.siteMapping[0].homeFolder = newFolder.fullPath;
// apply the changes
config.applyChanges();
}
john@Warp:~/tmp$ ssh admin@localhost -p 14983 "CustomAddUser testuser password C:\\Temp"
For information on developing 'adminlets', please refer to the EnterpriseDT repository on GitHub.