Folder.js

/**
* @classdesc Represents a folder in CompleteFTP's virtual file-system. Instances of this class should be obtained using 
* {@link FolderManager#get FolderManager.get}.
*
* @class
* @hideconstructor
*/
Folder = function () {
	/**
	* The ID of this folder.
	*
	* @type {String}
	* @readonly
	*/
	this.id = null;

	/**
	* The name of this folder.
	*
	* @type {String}
	*/
	this.name = null;

	/**
	* The absolute path of this folder in the virtual file-system.
	*
	* @type {String}
	* @readonly
	*/
	this.fullPath = null;

	/**
	* The date and time that this folder was created.
	*
	* @type {Date}
	* @readonly
	*/
	this.createdTime = null;

	/**
	* The date and time that this folder was last modified.
	*
	* @type {Date}
	* @readonly
	*/
	this.modifiedTime = null;

	/**
	* If this property is set to true, then this folder will not show up in listings.
	* This works independently of access permissions.  For example, a folder may be
	* shown but not accessible, or it may be hidden but still accessible.
	*
	* @type {Boolean}
	*/
	this.hidden = null;

	/**
	* Is this an inbuilt folder that's created automatically during installation?
	*
	* @type {Boolean}
	* @readonly
	*/
	this.inbuilt = null;

	/**
	* Is this an empty folder? If it is, then that means this folder has no subfolders in the virtual file-system.
	* 
	* Note that this does not indicate whether or not there are any subfolders or files in mapped folder in the
	* underlying file-system.
	*
	* @type {Boolean}
	* @readonly
	*/
	this.isFolderEmpty = null;

	/**
	* The type of this folder.
	* * 'VirtualFolder' - Folders of this type don't exist on the actual file system - they permit a virtual folder structure
	* to be created.
	* * 'WindowsFolder' - Standard Windows folders
	* * 'WindowsSpecialFolder' - Folders such as My Documents.
	* * 'NetworkMacroFolder' - Windows folders whose paths are specified by a URL into which various macros may optionally be substituted.
	* * 'GatewayFolder' - A gateway folder is a directory on a different server to the current CompleteFTP 
	* server instance. It is basically a remotely mounted directory (analogous to a network share).
	* 
	*
	* @type {String}
	* @readonly
	*/
	this.type = null;

	/**
	* Controls how the folder is mapped to the underlying file-system.
	* Notes:
	* * This property always returns null for Virtual folders.
	* * For Windows folders and Network/Macro folders, mappingPaths are Windows file-system paths. In addition,
	* Network/Macro folders' mappingPaths may include macros (listed below) or an 
	* [environment variable](https://en.wikipedia.org/wiki/Environment_variable). 
	* 	* %UserName% - User-name (without domain).
	* 	* %DomainName% - Domain name.
	* 	* %HomeBaseFolder% - Windows path of Home folder (i.e. parent of users' home folders).
	* 	* %ExternalHomeFolder% - [Database users only] Path read from user database.
	* * For Windows special folders, valid values should be:
	* 	* 'Home' (User's home folder)
	* 	* 'Personal' (User's My Documents folders)
	* 	* 'DesktopDirectory' (User's Desktop folder)
	* 	* 'MyPictures' (User's Pictures folder)
	* 	* 'MyMusic' (User's My Music folder)
	*
	* @type {String}
	*/
	this.mappingPath = null;

	/**
	* Returns a {@link Folder} object representing the parent-folder of this folder. Returns null if this folder is at the
	* top level (i.e. root).
	* 
	* @method
	* @return {Folder} 
	*/
	this.getParent = function () { }

	/** 
	* Returns an array of {@link Folder} objects representing all first-level subfolders of this folder.
	*
	* @method	
	* @return {Folder[]}
	*/
	this.list = function () { }

	/**
	* Adds a subfolder of the given type to this folder. Note that each subfolder of this folder 
	* must have a unique name.
	* Subfolders of different folder may have the same name.
	*
	* @method
	* @param {String} name Name of the folder to be created. 
	* @param {String} type Type of the folder. Currently, the following types are supported:
	* * 'VirtualFolder'
	* * 'WindowsFolder'
	* * 'WindowsSpecialFolder'
	* * 'NetworkMacroFolder'
	* @param {String} mappingPath Controls how the folder is mapped to the underlying file-system.  
	* Notes:
	* * This parameter is not required for Virtual folders.
	* * For Windows folders and Network/Macro folders, mappingPaths are Windows file-system paths. In addition,
	* Network/Macro folders' mappingPaths may include macros (listed below) or an 
	* [environment variable](https://en.wikipedia.org/wiki/Environment_variable). 
	* 	* %UserName% - User-name (without domain).
	* 	* %DomainName% - Domain name.
	* 	* %HomeBaseFolder% - Windows path of Home folder (i.e. parent of users' home folders).
	* 	* %ExternalHomeFolder% - [Database users only] Path read from user database.
	* * For Windows special folders, valid values should be:
	* 	* 'Home' (User's home folder)
	* 	* 'Personal' (User's My Documents folders)
	* 	* 'DesktopDirectory' (User's Desktop folder)
	* 	* 'MyPictures' (User's Pictures folder)
	* 	* 'MyMusic' (User's My Music folder)
	* @return {Folder}
	*/
	this.add = function (name, type, mappingPath) { }

	/**
	* Deletes this folder.
	*
	* @method
	* @param {Boolean} [recursive=false] If true, the folder will be deleted recursively. 
	*/
	this.remove = function (recursive) { }

	/**
	* Access control for non-Windows users to this folder.
	*
	* Permissions to Windows folders of non-Windows users and Windows users are  handled separately.
	* This setting only applies to non-Windows users. Permissions for Windows users are handled by Windows.
	*
	* @type {Object}
	* @property {Object} owner Specifies the owner as well as its permissions on this folder.
	*
	* @property {String} owner.userName User-name of the owner.
	*
	* @property {String[]} owner.permissions An array of strings contains the permissions that are given to 
	* the owner.
	*
	* Available permisisons are: 'FileRead', 'FileWrite', 'FileAppend', 'FileRename',
	* 'FileDelete', 'FileExecute', 'DirList', 'DirChange', 'DirCreate', 'DirRename', 'DirDelete',
	* 'IgnoreFilters'. 
	*
	* Set this property to the array, ['All'], to give the owner full permissions.
	*
	* @property {Object} group Specifies the user group as well as its permissions on this folder.
	*
	* A folder has a group to which permissions may be assigned.  When this is done then any non-Windows
	* user who is a member of that group will be granted the permission that that group has on the folder.
	*
	* @property {String} group.groupName Name of the group.
	*
	* @property {String[]} group.permissions An array of strings contains the permissions that are given to 
	* the user group.
	*
	* Available permisisons are: 'FileRead', 'FileWrite', 'FileAppend', 'FileRename',
	* 'FileDelete', 'FileExecute', 'DirList', 'DirChange', 'DirCreate', 'DirRename', 'DirDelete',
	* 'IgnoreFilters'. 
	*
	* Set this property to the array, ['All'], to give the group full permissions.
	*
	* @property {Object} allUsers Specifies the permissions of all other users on this folder.
	*
	* @property {String[]} allUsers.permissions An array of strings contains the permissions that are given to 
	* all other users.
	*
	* Available permisisons are: 'FileRead', 'FileWrite', 'FileAppend', 'FileRename',
	* 'FileDelete', 'FileExecute', 'DirList', 'DirChange', 'DirCreate', 'DirRename', 'DirDelete',
	* 'IgnoreFilters'. 
	*
	* Set this property to the array, ['All'], to give all other users full permissions.
	*
	* @property {Boolean} inherits Does this folder inherit permissions from its parent folder?
	*/
	this.access = null;
}