-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
145 lines (128 loc) · 3.92 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
'use strict';
const path = require('path');
const edge = require('edge');
const dllPath = path.join(__dirname, './lib/dll/release/Edge_FtpMgr.dll');
const dllLib = {};
/**
* Method: Create local account as ftp account
* @param {Object} account
* @param {string} account.userName ftp username
* @param {string} account.password ftp password
* @param {string} account.strNote ftp account description
* @param {string} account.expireDate the expired date string of ftp account
*/
dllLib.createLocalAccount = edge.func({
assemblyFile: dllPath,
typeName: 'Edge_FtpMgr.Startup',
methodName: 'CreateLocalAccountAsync'
});
/**
* Delete Local Account by UserName
* @param {string} userName the username of local account
* @return {boolean} true if successfully otherwise false
*/
dllLib.deleteLocalAccount = edge.func({
assemblyFile: dllPath,
typeName: 'Edge_FtpMgr.Startup',
methodName: 'DeleteLocalAccountAsync',
});
/**
* Disable or Enable Local Account by UserName
* @param {Object} params
* @param {string} params.userName the username of local account
* @param {boolean}params.enable true if enable otherwise false
* @return {boolean} true if successfully otherwise false
*/
dllLib.enableLocalAccount = edge.func({
assemblyFile: dllPath,
typeName: 'Edge_FtpMgr.Startup',
methodName: 'EnableLocalAccountAsync'
});
/**
* Get expire date of the account by UserName
* @param {string} userName the username of local account
* @return {string} expire date string
*/
dllLib.getExpireDateLocalAccount = edge.func({
assemblyFile: dllPath,
typeName: 'Edge_FtpMgr.Startup',
methodName: 'GetExpireDateLocalAccountAsync'
})
/**
* Reset expire date of the account by UserName
* @param {Object} params
* @param {string} params.userName the username fo the local account
* @param {string} params.expireDate the expire date
* @return {boolean} true if success, otherwise false
*/
dllLib.delayExpireDateLocalAccount = edge.func({
assemblyFile: dllPath,
typeName: 'Edge_FtpMgr.Startup',
methodName: 'DelayExpireDateLocalAccountAsync'
})
/**
* Method: Add virtual user
* You should supply several parameters
* @param {Object} options
* @property {string} siteName the Ftp Site Name
* @property {string} userName
* @property {string} physicalPath
*/
dllLib.addVirtualUser = edge.func({
assemblyFile: dllPath,
typeName: 'Edge_FtpMgr.Startup',
methodName: 'AddVirtualUserAsync'
});
/**
* Delete Virtual User
* @param {Object} params
* @param {string} params.siteName the Ftp site name
* @param {string} params.userName the local account username
* @return {boolean} true if success, otherwise false
*/
dllLib.deleteVirtualUser = edge.func({
assemblyFile: dllPath,
typeName: 'Edge_FtpMgr.Startup',
methodName: 'DeleteVirtualUserAsync',
});
/**
* Add User Permissions
* @param {Object} Object
* @param {string} Object.siteName site name
* @param {string} Object.userName username
* @param {number} Object.permission 1 for read 2 for RW
*/
dllLib.addUserPermission = edge.func({
assemblyFile: dllPath,
typeName: 'Edge_FtpMgr.Startup',
methodName: 'AddUserPermissionAsync'
});
/**
* Add User
* @param {Object} Object
* @param {string} Object.siteName site name
* @param {string} Object.applicationPool application pool name
* @param {string} Object.userName username
* @param {string} Object.password password
* @param {string} Object.homeDir home path
* @param {string} Object.expireDate expire date
* @param {string} Object.strNote note
* @param {number} Object.permission 1 readonly 2 read and write
*/
dllLib.addUser = edge.func({
assemblyFile: dllPath,
typeName: 'Edge_FtpMgr.Startup',
methodName: 'addUserAsync'
});
/**
* remove User
* @param {Object} Object
* @param {string} Object.siteName site name
* @param {string} Object.userName username
*/
dllLib.removeUser = edge.func({
assemblyFile: dllPath,
typeName: 'Edge_FtpMgr.Startup',
methodName: 'removeUserAsync'
});
module.exports = dllLib;