Home
|
Macrobyte Resources
Rumpus GlueVersion: 1.0 Table of Contents
|
| File | Encoding | For | Filesize |
|---|---|---|---|
| Rumpus.Frontier.bin | MacBinary | Frontier 5 - Mac | 16 Kb |
| Rumpus.Frontier.hqx | BinHex | Frontier 5 - Mac | 20 Kb |
The AppleEvent interface (scripting interface) in Rumpus is designed for one purpose only: to allow user-management. A user, in this case, is an account on the FTP server. It provides functions (events) for creating new users, deleting users, and getting and setting a user's preferences (account permissions, mostly).
Account information is passed back and forth to Rumpus as a string: each line of the string represents a single preference for the user. However, it was found that working with strings this way, in Frontier, made the suite fairly difficult to use. As a result, the basic block of information your scripts must deal with is a UserInfoRec.
The UserInfoRec is a record in which each key/value pair represents one account preference. Create a UserInfoRec by calling rumpus.utils.userInfoRec( ), which will return a record with every field pre-defined. Any parameters you pass are used to initialize the record. For example:
That would return a record which looks like this:
rumpus.utils.userInfoRec( "george@jungle.org", "youJane", "Macintosh HD:FTP Incoming:george@jungle.org:" )
Unspecified permission flags (keys begining with 'p') are created as empty strings, rather than as booleans. That way, if you don't specify the value by changing the record, Rumpus's default setting will be used.
{
'user': "george@jungle.org",
'pswd': "youJane",
'drop': "Macintosh HD:FTP Incoming:george@jungle.org:",
'maxf': 0,
'rtod': "",
'pLog': "",
'pSee': "",
'pDow': "",
'pUpl': "",
'pDel': "",
'pDlf': ""
}
The account preferences are as follows:
| Record Key | String4 | Description |
|---|---|---|
| Username | user | String. The account's name, the name which the user uses to log into the FTP account. Example: george@jungle.org or ANONYMOUS. |
| Password | pswd | String. The account's password. Use an empty string "" if you don't want the account to have any password (such as the ANONYMOUS account). |
| MaxFolderSize | maxf | Integer. Maximum amount of disk space (expressed in megabytes), that the user can store in the drop folder. |
| PermitCreateFolders | pCrf | Boolean. Allow this user to create subfolders within the drop folder? |
| PermitDelete | pDel | Boolean. Allow this user to delete files? |
| PermitDeleteFolders | pDlf | Boolean. Allow this user to delete subfolders of the drop folder? |
| PermitDownload | pDow | Boolean. Allow this user to download files from the drop folder? |
| PermitLogin | pLog | Boolean. Allow this user to log in? If false, then the account is effectively disabled. |
| PermitSeeFiles | pSee | Boolean. Allow this user to see directory listsings. If false, then the user must know the exact pathname/filename in order to download a file. |
| PermitUpload | pUpl | Boolean. Allow this user to upload files to the drop folder? |
| RestrictToDropFolder | rtod | Boolean. Allow this user to climb out of the drop folder (up the directory hierarchy)? |
Create new users with the script rumpus.addUser( ). AddUser takes one parameter: a UserInfoRec record, which you should create with rumpus.utils.userInfoRec( ). Example:
local ( userRec );
userRec = rumpus.utils.userInfoRec( "george@jungle.org", "youJane", \
"Macintosh HD:FTP Incoming:george@jungle.org:" );
rumpus.addUser( userRec )
See the test code at the end of rumpus.addUser( ) for a more lengthy example.
To delete a user, pass the account name to rumpus.deleteUser( ). Example:
rumpus.deleteUser( "george@jungle.org" )
To get all of the information for a single account, pass the account's username to rumpus.getUserDetail( ), which will return a UserInfoRec record as described above. Example:
rumpus.getUserDetail( "george@jungle.org" )
There are two ways to changes an account's settings. If you only want/need to change one setting, then use rumpus.changeUserPref( ), which takes three parameters.
Example:
with rumpus {
rumpus.changeUserPref( "george@jungle.org", Password, "monkeyKing" ) }
If you need to change more than one setting, then do something similar to the following:
local ( user = "george@jungle.org" );
// get the account info
local ( userRec = rumpus.getUserDetail( user ) );
// change the password
userRec[ Password ] = "swingingSingle";
// allow up to 12 megabytes in user account's directory
userRec[ MaxFolderSize ] = 12;
// permit the user to create directories
userRec[ PermitCreateFolders ] = true;
// premit the user to delete directories
userRec[ PermitDeleteFolders ] = true;
// delete the old user account
deleteUser( user );
// re-create the user account with the new settings
addUser( userRec ) }