system
Members
(static) currentFolder :string
- Description:
The current working directory for the current session. Can be read and assigned.
- Source:
The current working directory for the current session. Can be read and assigned.
Type:
- string
(static) inlineHtml :string
- Description:
HTML included in .htmljss files. Files with the extension, .htmljss, may have a literal HTML at the beginning and then JSS code after a line containing the comment, . This variable contains the HTML.
- Source:
HTML included in .htmljss files. Files with the extension, .htmljss, may have a literal HTML at the beginning and then JSS code after a line containing the comment, . This variable contains the HTML.
Type:
- string
(static) nextScriptPath :string
- Description:
Path of script to be executed next (before the HTTP response is returned). JSS scripts can be chained together such that, after one JSS script is executed, another JSS script is executed before the response is returned. This is done by setting the nextScriptPath field. If the field is not set then the HTTP response, as it's currently set, will be returned.
- Source:
Path of script to be executed next (before the HTTP response is returned). JSS scripts can be chained together such that, after one JSS script is executed, another JSS script is executed before the response is returned. This is done by setting the nextScriptPath field. If the field is not set then the HTTP response, as it's currently set, will be returned.
Type:
- string
(static) passwordPolicy :Object
- Description:
Password policy applied to new passwords.
The object has the properties listed below:
- Source:
Properties:
Name | Type | Description |
---|---|---|
allowChange |
Boolean | True if users are allowed to change their own password. |
minLength |
Number | Minimum number of characters required. |
mustHaveMixedCase |
Boolean | True if passwords must have at least one upper-case and at least one lower-case letter. |
mustHaveDigit |
Boolean | True if passwords must include at least one digit. |
mustHaveSpecialChar |
Boolean | True if passwords must include at least one of the following characters: !"#$%&'()*+,-./: |
expirySoftDays |
Number | Number of days since last password change until they are required to change their password when they log in. Null (default) means never. |
expiryHardDays |
Number | Number of days since last password change until a password expires, preventing the user from logging in. Null (default) means never. |
Password policy applied to new passwords.
The object has the properties listed below:
Type:
- Object
(static) previouscriptPath :string
- Description:
Path of script previously executed in this request (see nextScriptPath). JSS scripts can be chained together such that, after one JSS script is executed, another JSS script is executed before the response is returned.
- Source:
Path of script previously executed in this request (see nextScriptPath). JSS scripts can be chained together such that, after one JSS script is executed, another JSS script is executed before the response is returned.
Type:
- string
(static) server :Object
Properties:
Name | Type | Description |
---|---|---|
name |
String | Name of the server. |
ipAddresses |
Array.<String> | IP addresses available on the server. |
Represents the current server.
Type:
- Object
(static) shares :ShareAPI
- Description:
Provides the APIs for managing the logged=in user's shared files.
- Source:
Provides the APIs for managing the logged=in user's shared files.
Type:
(static) site :SiteInfo
- Description:
Represents the CompleteFTP site that is serving up this script.
- Source:
Represents the CompleteFTP site that is serving up this script.
Type:
(static) user :Object
- Description:
Represents the currently logged in user or the anonymous user, if a user isn't logged in.
The object has the properties listed below, as well as a method
changePassword(newPassword)
, which changes the password of the user tonewPassword
.
- Source:
Properties:
Name | Type | Description |
---|---|---|
fullName |
String | Full name of the user |
email |
String | Email address of user |
description |
String | Description of user |
userName |
String | User-name of the user (excluding any domain-name). |
fullUserName |
String | Full user-name of the user (including any domain-name). |
domainName |
String | Domain-name of the user. |
isAnonymous |
Boolean | True if no user is currently logged in. |
homeFolder |
String | Absolute path of the user's home-folder. |
apparentHomeFolder |
String | Path of the user's home-folder as it appears to the user. |
uniqueID |
String | string that's unique for every user, including those authenticated by authenticators. |
sharingEnabled |
Boolean | True is sharing is enabled for this user. |
tfaEnabled |
Boolean | True if two-factor authentication (2FA) is enabled. |
tfaInitialized |
Boolean | True if the user has activated a 2FA device (can be set). |
tfaValidated |
Boolean | True if the user has entered a valid 2FA PIN in the current session (can be set). |
tfaBackupPINs |
Array | Array of strings representing the user's 2FA backup PINs (can be set). |
mustChangePassword |
Boolean | True if the user must change their password when they log in |
allowChangePassword |
Boolean | True if the user is able to change their password |
tags |
Object | Encapsulates a set of name-value pairs whose lifetime is that of the session. Methods:
|
Represents the currently logged in user or the anonymous user, if a user isn't logged in.
The object has the properties listed below, as well as a method changePassword(newPassword)
,
which changes the password of the user to newPassword
.
Type:
- Object
Methods
(static) changeConfig(callback)
- Description:
[Admins only] Change configuration of CompleteFTP server via a callback function. The callback function passed in as an argument is called with a Config object as an argument. Changes made to this object will be applied automatically after the callback function returns unless and exception is thrown in the callback function. Calling this method will give the same result as calling getConfig(), making changes to the returned object and calling applyChanges() on that object.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
callback |
ChangeConfigCallback | Callback function that takes a Config object as an argument. |
(static) checkLogin(extraCheckFunctionopt)
- Description:
Checks if a user is logged in and throws an 'unauthorized access' exception if not. In HTTP, this will result in a 401 error being returned to the client. A function may optionally be passed in if additional checks are required. This function will trigger an exception if it returns a string or if it throws an exception.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
extraCheckFunction |
String |
<optional> |
Optional function that can implement checks in addition to the default login check. If this function returns a string or throws an exception then an error will be triggered with message returned or thrown. |
(static) executeCustomCommand(commandName, parametersopt) → {String}
- Description:
Executes a custom command and returns the result. Custom commands are methods that have been implemented in .NET Custom Command Extensions and JSS Custom Command Scripts. There are some inbuilt commands, including administration commands and the file-sharing commands (ask support), but you can also add your own.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
commandName |
String | Name of the custom command (e.g. "useradd") |
|
parameters |
Array.<String> |
<optional> |
Arguments to be passed to the command. |
Returns:
Result of the command.
- Type
- String
(static) getConfig() → {Config}
- Description:
[Admins only] Returns a Config object representing the current configuration of CompleteFTP server. This function may only be executed by members of the admins group or by scripts that are owned by members of the admin group.
- Source:
Returns:
- Type
- Config
(static) getFile(path) → {File}
- Description:
Returns a File object for the given path.
The File object may or may not represent an existing file or directory.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
path |
String | Path of file |
Returns:
- Type
- File
(static) getMonitor() → {Monitor}
Returns:
Object containing information about the current state of the system.
- Type
- Monitor
(static) getPasswordResetInfo(userNameOrEmail) → {Array.<PasswordResetInfo>}
- Description:
Returns an array of PasswordResetInfo objects for users that match the given user-name or email address.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
userNameOrEmail |
String | User-name or email address. |
Returns:
- Type
- Array.<PasswordResetInfo>
(static) getPublicKeyInfo() → {PublicKeyInfo}
- Description:
Returns the type and fingerprint of key stored in the encodedKey argument, as well as the same key in OpenSSH format, which is the format CompleteFTP uses to store key internally.
- Source:
Returns:
Key information or null if the key could not be parsed.
- Type
- PublicKeyInfo
(static) login(userName, password, usePublicFolderAsRootopt, persistentCookieopt)
- Description:
Log in using the given user-name and password, or throws an exception indicating that the user could not be authenticated. Until this function is invoked the active user will be the 'anonymous' user. Logins are associated with session IDs, which are stored in a cookie named "__cftp_sessid". Cookies must therefore be enabled for logins to work. Users must be set up within CompleteFTP. If users are to be managed from within the web-app then CompleteFTP's database authentication should be used in combination with the server-side WebSQLDatabase feature (see openDatabaseSync). Use the user property to access information about the active user.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
userName |
String | User-name |
|
password |
String | Password |
|
usePublicFolderAsRoot |
Boolean |
<optional> |
If |
persistentCookie |
Boolean |
<optional> |
If |
(static) logout()
(static) openDatabaseSync(connectionString) → {DatabaseSync}
- Description:
Opens a connection to the database with the given connection-string. The
connectionString
must be either the virtual file-system path of an SQLite or SQL Server Compact file, or a prefixed database connection-string. The prefixes are shown below:Connection-type Prefix File-extension Database DLLs required? SQLite sqlite:* .sqlite3 no SQL Server Compact sqlserverce:* .sdf no SQL Server sqlserver: n/a no ODBC odbc: n/a no OLE DB oledb: n/a yes** * - Prefixes are only required for SQLite and SQL Server Compact if the listed file-extension isn't being used.
** - For OLE DB connections the DLLs for the specific database being accessed must be placed in the same directory as the CompleteFTP server executables.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
connectionString |
String | Connection-string. |
Returns:
- Type
- DatabaseSync
(static) processPasswordReset(userNameOrEmail) → {Object}
- Description:
Returns an array of PasswordResetInfo objects for users that match the given user-name or email address.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
userNameOrEmail |
String | User-name or email address. |
Returns:
- Type
- Object
(static) sudo(action)
- Description:
[Admins only] sudo = Super-User DO. Like its UNIX counterpart, this function executes the given action in the admin user context. Windows resources will be accessed in the context of the user that's running the CompleteFTP service, which by default is SYSTEM. Care should be taken when using this function as the admin user has much greater permissions than non-admin users, so there is a higher potential for misbehaviour. This function may only be executed by members of the admins group or by scripts that are owned by members of the admin group.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
action |
function | Function containing the actions to be run in the admin user context. |