files.com 1.2.278 → 1.2.280
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_VERSION +1 -1
- package/docs/models/UserCipherUse.md +6 -0
- package/docs/models/UserLifecycleRule.md +13 -6
- package/lib/Files.js +1 -1
- package/lib/models/UserCipherUse.js +6 -0
- package/lib/models/UserLifecycleRule.js +41 -80
- package/package.json +1 -1
- package/src/Files.js +1 -1
- package/src/models/UserCipherUse.js +6 -0
- package/src/models/UserLifecycleRule.js +23 -42
package/_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.2.
|
|
1
|
+
1.2.280
|
|
@@ -38,3 +38,9 @@ await UserCipherUse.list({
|
|
|
38
38
|
* `user_id` (int64): User ID. If provided, will return uses for this user.
|
|
39
39
|
* `cursor` (string): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
|
40
40
|
* `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
41
|
+
* `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `updated_at`.
|
|
42
|
+
* `filter` (object): If set, return records where the specified field is equal to the supplied value. Valid fields are `insecure` and `updated_at`. Valid field combinations are `[ insecure, updated_at ]`.
|
|
43
|
+
* `filter_gt` (object): If set, return records where the specified field is greater than the supplied value. Valid fields are `updated_at`.
|
|
44
|
+
* `filter_gteq` (object): If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `updated_at`.
|
|
45
|
+
* `filter_lt` (object): If set, return records where the specified field is less than the supplied value. Valid fields are `updated_at`.
|
|
46
|
+
* `filter_lteq` (object): If set, return records where the specified field is less than or equal the supplied value. Valid fields are `updated_at`.
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"include_site_admins": true,
|
|
12
12
|
"action": "disable",
|
|
13
13
|
"user_state": "inactive",
|
|
14
|
+
"name": "password specific rules",
|
|
14
15
|
"site_id": 1
|
|
15
16
|
}
|
|
16
17
|
```
|
|
@@ -22,6 +23,7 @@
|
|
|
22
23
|
* `include_site_admins` (boolean): Include site admins in the rule
|
|
23
24
|
* `action` (string): Action to take on inactive users (disable or delete)
|
|
24
25
|
* `user_state` (string): State of the users to apply the rule to (inactive or disabled)
|
|
26
|
+
* `name` (string): User Lifecycle Rule name
|
|
25
27
|
* `site_id` (int64): Site ID
|
|
26
28
|
|
|
27
29
|
---
|
|
@@ -62,18 +64,20 @@ await UserLifecycleRule.create({
|
|
|
62
64
|
'include_site_admins': true,
|
|
63
65
|
'include_folder_admins': true,
|
|
64
66
|
'user_state': "inactive",
|
|
67
|
+
'name': "password specific rules",
|
|
65
68
|
})
|
|
66
69
|
```
|
|
67
70
|
|
|
68
71
|
|
|
69
72
|
### Parameters
|
|
70
73
|
|
|
71
|
-
* `action` (string):
|
|
72
|
-
* `authentication_method` (string):
|
|
73
|
-
* `inactivity_days` (int64):
|
|
74
|
+
* `action` (string): Action to take on inactive users (disable or delete)
|
|
75
|
+
* `authentication_method` (string): User authentication method for the rule
|
|
76
|
+
* `inactivity_days` (int64): Number of days of inactivity before the rule applies
|
|
74
77
|
* `include_site_admins` (boolean): Include site admins in the rule
|
|
75
78
|
* `include_folder_admins` (boolean): Include folder admins in the rule
|
|
76
79
|
* `user_state` (string): State of the users to apply the rule to (inactive or disabled)
|
|
80
|
+
* `name` (string): User Lifecycle Rule name
|
|
77
81
|
|
|
78
82
|
---
|
|
79
83
|
|
|
@@ -88,18 +92,20 @@ await user_lifecycle_rule.update({
|
|
|
88
92
|
'include_site_admins': true,
|
|
89
93
|
'include_folder_admins': true,
|
|
90
94
|
'user_state': "inactive",
|
|
95
|
+
'name': "password specific rules",
|
|
91
96
|
})
|
|
92
97
|
```
|
|
93
98
|
|
|
94
99
|
### Parameters
|
|
95
100
|
|
|
96
101
|
* `id` (int64): Required - User Lifecycle Rule ID.
|
|
97
|
-
* `action` (string):
|
|
98
|
-
* `authentication_method` (string):
|
|
99
|
-
* `inactivity_days` (int64):
|
|
102
|
+
* `action` (string): Action to take on inactive users (disable or delete)
|
|
103
|
+
* `authentication_method` (string): User authentication method for the rule
|
|
104
|
+
* `inactivity_days` (int64): Number of days of inactivity before the rule applies
|
|
100
105
|
* `include_site_admins` (boolean): Include site admins in the rule
|
|
101
106
|
* `include_folder_admins` (boolean): Include folder admins in the rule
|
|
102
107
|
* `user_state` (string): State of the users to apply the rule to (inactive or disabled)
|
|
108
|
+
* `name` (string): User Lifecycle Rule name
|
|
103
109
|
|
|
104
110
|
### Example Response
|
|
105
111
|
|
|
@@ -112,6 +118,7 @@ await user_lifecycle_rule.update({
|
|
|
112
118
|
"include_site_admins": true,
|
|
113
119
|
"action": "disable",
|
|
114
120
|
"user_state": "inactive",
|
|
121
|
+
"name": "password specific rules",
|
|
115
122
|
"site_id": 1
|
|
116
123
|
}
|
|
117
124
|
```
|
package/lib/Files.js
CHANGED
|
@@ -12,7 +12,7 @@ var apiKey;
|
|
|
12
12
|
var baseUrl = 'https://app.files.com';
|
|
13
13
|
var sessionId = null;
|
|
14
14
|
var language = null;
|
|
15
|
-
var version = '1.2.
|
|
15
|
+
var version = '1.2.280';
|
|
16
16
|
var userAgent = "Files.com JavaScript SDK v".concat(version);
|
|
17
17
|
var logLevel = _Logger.LogLevel.INFO;
|
|
18
18
|
var debugRequest = false;
|
|
@@ -78,6 +78,12 @@ _UserCipherUse = UserCipherUse;
|
|
|
78
78
|
// user_id - int64 - User ID. If provided, will return uses for this user.
|
|
79
79
|
// cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
|
80
80
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
81
|
+
// sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `updated_at`.
|
|
82
|
+
// filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `insecure` and `updated_at`. Valid field combinations are `[ insecure, updated_at ]`.
|
|
83
|
+
// filter_gt - object - If set, return records where the specified field is greater than the supplied value. Valid fields are `updated_at`.
|
|
84
|
+
// filter_gteq - object - If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `updated_at`.
|
|
85
|
+
// filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `updated_at`.
|
|
86
|
+
// filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `updated_at`.
|
|
81
87
|
(0, _defineProperty2.default)(UserCipherUse, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
82
88
|
var _response$data;
|
|
83
89
|
var params,
|
|
@@ -81,6 +81,13 @@ var UserLifecycleRule = /*#__PURE__*/(0, _createClass2.default)(function UserLif
|
|
|
81
81
|
(0, _defineProperty2.default)(this, "setUserState", function (value) {
|
|
82
82
|
_this.attributes.user_state = value;
|
|
83
83
|
});
|
|
84
|
+
// string # User Lifecycle Rule name
|
|
85
|
+
(0, _defineProperty2.default)(this, "getName", function () {
|
|
86
|
+
return _this.attributes.name;
|
|
87
|
+
});
|
|
88
|
+
(0, _defineProperty2.default)(this, "setName", function (value) {
|
|
89
|
+
_this.attributes.name = value;
|
|
90
|
+
});
|
|
84
91
|
// int64 # Site ID
|
|
85
92
|
(0, _defineProperty2.default)(this, "getSiteId", function () {
|
|
86
93
|
return _this.attributes.site_id;
|
|
@@ -89,12 +96,13 @@ var UserLifecycleRule = /*#__PURE__*/(0, _createClass2.default)(function UserLif
|
|
|
89
96
|
_this.attributes.site_id = value;
|
|
90
97
|
});
|
|
91
98
|
// Parameters:
|
|
92
|
-
// action
|
|
93
|
-
// authentication_method
|
|
94
|
-
// inactivity_days
|
|
99
|
+
// action - string - Action to take on inactive users (disable or delete)
|
|
100
|
+
// authentication_method - string - User authentication method for the rule
|
|
101
|
+
// inactivity_days - int64 - Number of days of inactivity before the rule applies
|
|
95
102
|
// include_site_admins - boolean - Include site admins in the rule
|
|
96
103
|
// include_folder_admins - boolean - Include folder admins in the rule
|
|
97
104
|
// user_state - string - State of the users to apply the rule to (inactive or disabled)
|
|
105
|
+
// name - string - User Lifecycle Rule name
|
|
98
106
|
(0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
99
107
|
var params,
|
|
100
108
|
response,
|
|
@@ -146,68 +154,32 @@ var UserLifecycleRule = /*#__PURE__*/(0, _createClass2.default)(function UserLif
|
|
|
146
154
|
}
|
|
147
155
|
throw new errors.InvalidParameterError("Bad parameter: user_state must be of type String, received ".concat((0, _utils.getType)(params.user_state)));
|
|
148
156
|
case 7:
|
|
149
|
-
if (params.
|
|
150
|
-
_context.next = 9;
|
|
151
|
-
break;
|
|
152
|
-
}
|
|
153
|
-
if (!_this.attributes.id) {
|
|
157
|
+
if (!(params.name && !(0, _utils.isString)(params.name))) {
|
|
154
158
|
_context.next = 8;
|
|
155
159
|
break;
|
|
156
160
|
}
|
|
157
|
-
|
|
158
|
-
_context.next = 9;
|
|
159
|
-
break;
|
|
161
|
+
throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(params.name)));
|
|
160
162
|
case 8:
|
|
161
|
-
|
|
162
|
-
case 9:
|
|
163
|
-
if (params.action) {
|
|
164
|
-
_context.next = 11;
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
if (!_this.attributes.action) {
|
|
163
|
+
if (params.id) {
|
|
168
164
|
_context.next = 10;
|
|
169
165
|
break;
|
|
170
166
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
break;
|
|
174
|
-
case 10:
|
|
175
|
-
throw new errors.MissingParameterError('Parameter missing: action');
|
|
176
|
-
case 11:
|
|
177
|
-
if (params.authentication_method) {
|
|
178
|
-
_context.next = 13;
|
|
179
|
-
break;
|
|
180
|
-
}
|
|
181
|
-
if (!_this.attributes.authentication_method) {
|
|
182
|
-
_context.next = 12;
|
|
183
|
-
break;
|
|
184
|
-
}
|
|
185
|
-
params.authentication_method = _this.authentication_method;
|
|
186
|
-
_context.next = 13;
|
|
187
|
-
break;
|
|
188
|
-
case 12:
|
|
189
|
-
throw new errors.MissingParameterError('Parameter missing: authentication_method');
|
|
190
|
-
case 13:
|
|
191
|
-
if (params.inactivity_days) {
|
|
192
|
-
_context.next = 15;
|
|
193
|
-
break;
|
|
194
|
-
}
|
|
195
|
-
if (!_this.attributes.inactivity_days) {
|
|
196
|
-
_context.next = 14;
|
|
167
|
+
if (!_this.attributes.id) {
|
|
168
|
+
_context.next = 9;
|
|
197
169
|
break;
|
|
198
170
|
}
|
|
199
|
-
params.
|
|
200
|
-
_context.next =
|
|
171
|
+
params.id = _this.id;
|
|
172
|
+
_context.next = 10;
|
|
201
173
|
break;
|
|
202
|
-
case
|
|
203
|
-
throw new errors.MissingParameterError('Parameter missing:
|
|
204
|
-
case
|
|
205
|
-
_context.next =
|
|
174
|
+
case 9:
|
|
175
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
|
176
|
+
case 10:
|
|
177
|
+
_context.next = 11;
|
|
206
178
|
return _Api.default.sendRequest("/user_lifecycle_rules/".concat(encodeURIComponent(params.id)), 'PATCH', params, _this.options);
|
|
207
|
-
case
|
|
179
|
+
case 11:
|
|
208
180
|
response = _context.sent;
|
|
209
181
|
return _context.abrupt("return", new UserLifecycleRule(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
|
210
|
-
case
|
|
182
|
+
case 12:
|
|
211
183
|
case "end":
|
|
212
184
|
return _context.stop();
|
|
213
185
|
}
|
|
@@ -404,12 +376,13 @@ _UserLifecycleRule = UserLifecycleRule;
|
|
|
404
376
|
return _UserLifecycleRule.find(id, params, options);
|
|
405
377
|
});
|
|
406
378
|
// Parameters:
|
|
407
|
-
// action
|
|
408
|
-
// authentication_method
|
|
409
|
-
// inactivity_days
|
|
379
|
+
// action - string - Action to take on inactive users (disable or delete)
|
|
380
|
+
// authentication_method - string - User authentication method for the rule
|
|
381
|
+
// inactivity_days - int64 - Number of days of inactivity before the rule applies
|
|
410
382
|
// include_site_admins - boolean - Include site admins in the rule
|
|
411
383
|
// include_folder_admins - boolean - Include folder admins in the rule
|
|
412
384
|
// user_state - string - State of the users to apply the rule to (inactive or disabled)
|
|
385
|
+
// name - string - User Lifecycle Rule name
|
|
413
386
|
(0, _defineProperty2.default)(UserLifecycleRule, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
414
387
|
var params,
|
|
415
388
|
options,
|
|
@@ -420,54 +393,42 @@ _UserLifecycleRule = UserLifecycleRule;
|
|
|
420
393
|
case 0:
|
|
421
394
|
params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
|
|
422
395
|
options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
423
|
-
if (params.action) {
|
|
396
|
+
if (!(params.action && !(0, _utils.isString)(params.action))) {
|
|
424
397
|
_context6.next = 1;
|
|
425
398
|
break;
|
|
426
399
|
}
|
|
427
|
-
throw new errors.
|
|
400
|
+
throw new errors.InvalidParameterError("Bad parameter: action must be of type String, received ".concat((0, _utils.getType)(params.action)));
|
|
428
401
|
case 1:
|
|
429
|
-
if (params.authentication_method) {
|
|
402
|
+
if (!(params.authentication_method && !(0, _utils.isString)(params.authentication_method))) {
|
|
430
403
|
_context6.next = 2;
|
|
431
404
|
break;
|
|
432
405
|
}
|
|
433
|
-
throw new errors.
|
|
406
|
+
throw new errors.InvalidParameterError("Bad parameter: authentication_method must be of type String, received ".concat((0, _utils.getType)(params.authentication_method)));
|
|
434
407
|
case 2:
|
|
435
|
-
if (params.inactivity_days) {
|
|
408
|
+
if (!(params.inactivity_days && !(0, _utils.isInt)(params.inactivity_days))) {
|
|
436
409
|
_context6.next = 3;
|
|
437
410
|
break;
|
|
438
411
|
}
|
|
439
|
-
throw new errors.
|
|
412
|
+
throw new errors.InvalidParameterError("Bad parameter: inactivity_days must be of type Int, received ".concat((0, _utils.getType)(params.inactivity_days)));
|
|
440
413
|
case 3:
|
|
441
|
-
if (!(params.
|
|
414
|
+
if (!(params.user_state && !(0, _utils.isString)(params.user_state))) {
|
|
442
415
|
_context6.next = 4;
|
|
443
416
|
break;
|
|
444
417
|
}
|
|
445
|
-
throw new errors.InvalidParameterError("Bad parameter:
|
|
418
|
+
throw new errors.InvalidParameterError("Bad parameter: user_state must be of type String, received ".concat((0, _utils.getType)(params.user_state)));
|
|
446
419
|
case 4:
|
|
447
|
-
if (!(params.
|
|
420
|
+
if (!(params.name && !(0, _utils.isString)(params.name))) {
|
|
448
421
|
_context6.next = 5;
|
|
449
422
|
break;
|
|
450
423
|
}
|
|
451
|
-
throw new errors.InvalidParameterError("Bad parameter:
|
|
424
|
+
throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(params.name)));
|
|
452
425
|
case 5:
|
|
453
|
-
|
|
454
|
-
_context6.next = 6;
|
|
455
|
-
break;
|
|
456
|
-
}
|
|
457
|
-
throw new errors.InvalidParameterError("Bad parameter: inactivity_days must be of type Int, received ".concat((0, _utils.getType)(params.inactivity_days)));
|
|
458
|
-
case 6:
|
|
459
|
-
if (!(params.user_state && !(0, _utils.isString)(params.user_state))) {
|
|
460
|
-
_context6.next = 7;
|
|
461
|
-
break;
|
|
462
|
-
}
|
|
463
|
-
throw new errors.InvalidParameterError("Bad parameter: user_state must be of type String, received ".concat((0, _utils.getType)(params.user_state)));
|
|
464
|
-
case 7:
|
|
465
|
-
_context6.next = 8;
|
|
426
|
+
_context6.next = 6;
|
|
466
427
|
return _Api.default.sendRequest('/user_lifecycle_rules', 'POST', params, options);
|
|
467
|
-
case
|
|
428
|
+
case 6:
|
|
468
429
|
response = _context6.sent;
|
|
469
430
|
return _context6.abrupt("return", new _UserLifecycleRule(response === null || response === void 0 ? void 0 : response.data, options));
|
|
470
|
-
case
|
|
431
|
+
case 7:
|
|
471
432
|
case "end":
|
|
472
433
|
return _context6.stop();
|
|
473
434
|
}
|
package/package.json
CHANGED
package/src/Files.js
CHANGED
|
@@ -53,6 +53,12 @@ class UserCipherUse {
|
|
|
53
53
|
// user_id - int64 - User ID. If provided, will return uses for this user.
|
|
54
54
|
// cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
|
55
55
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
56
|
+
// sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `updated_at`.
|
|
57
|
+
// filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `insecure` and `updated_at`. Valid field combinations are `[ insecure, updated_at ]`.
|
|
58
|
+
// filter_gt - object - If set, return records where the specified field is greater than the supplied value. Valid fields are `updated_at`.
|
|
59
|
+
// filter_gteq - object - If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `updated_at`.
|
|
60
|
+
// filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `updated_at`.
|
|
61
|
+
// filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `updated_at`.
|
|
56
62
|
static list = async (params = {}, options = {}) => {
|
|
57
63
|
if (params.user_id && !isInt(params.user_id)) {
|
|
58
64
|
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params.user_id)}`)
|
|
@@ -77,6 +77,13 @@ class UserLifecycleRule {
|
|
|
77
77
|
this.attributes.user_state = value
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
// string # User Lifecycle Rule name
|
|
81
|
+
getName = () => this.attributes.name
|
|
82
|
+
|
|
83
|
+
setName = value => {
|
|
84
|
+
this.attributes.name = value
|
|
85
|
+
}
|
|
86
|
+
|
|
80
87
|
// int64 # Site ID
|
|
81
88
|
getSiteId = () => this.attributes.site_id
|
|
82
89
|
|
|
@@ -85,12 +92,13 @@ class UserLifecycleRule {
|
|
|
85
92
|
}
|
|
86
93
|
|
|
87
94
|
// Parameters:
|
|
88
|
-
// action
|
|
89
|
-
// authentication_method
|
|
90
|
-
// inactivity_days
|
|
95
|
+
// action - string - Action to take on inactive users (disable or delete)
|
|
96
|
+
// authentication_method - string - User authentication method for the rule
|
|
97
|
+
// inactivity_days - int64 - Number of days of inactivity before the rule applies
|
|
91
98
|
// include_site_admins - boolean - Include site admins in the rule
|
|
92
99
|
// include_folder_admins - boolean - Include folder admins in the rule
|
|
93
100
|
// user_state - string - State of the users to apply the rule to (inactive or disabled)
|
|
101
|
+
// name - string - User Lifecycle Rule name
|
|
94
102
|
update = async (params = {}) => {
|
|
95
103
|
if (!this.attributes.id) {
|
|
96
104
|
throw new errors.EmptyPropertyError('Current object has no id')
|
|
@@ -121,6 +129,10 @@ class UserLifecycleRule {
|
|
|
121
129
|
throw new errors.InvalidParameterError(`Bad parameter: user_state must be of type String, received ${getType(params.user_state)}`)
|
|
122
130
|
}
|
|
123
131
|
|
|
132
|
+
if (params.name && !isString(params.name)) {
|
|
133
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params.name)}`)
|
|
134
|
+
}
|
|
135
|
+
|
|
124
136
|
if (!params.id) {
|
|
125
137
|
if (this.attributes.id) {
|
|
126
138
|
params.id = this.id
|
|
@@ -129,30 +141,6 @@ class UserLifecycleRule {
|
|
|
129
141
|
}
|
|
130
142
|
}
|
|
131
143
|
|
|
132
|
-
if (!params.action) {
|
|
133
|
-
if (this.attributes.action) {
|
|
134
|
-
params.action = this.action
|
|
135
|
-
} else {
|
|
136
|
-
throw new errors.MissingParameterError('Parameter missing: action')
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (!params.authentication_method) {
|
|
141
|
-
if (this.attributes.authentication_method) {
|
|
142
|
-
params.authentication_method = this.authentication_method
|
|
143
|
-
} else {
|
|
144
|
-
throw new errors.MissingParameterError('Parameter missing: authentication_method')
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (!params.inactivity_days) {
|
|
149
|
-
if (this.attributes.inactivity_days) {
|
|
150
|
-
params.inactivity_days = this.inactivity_days
|
|
151
|
-
} else {
|
|
152
|
-
throw new errors.MissingParameterError('Parameter missing: inactivity_days')
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
144
|
const response = await Api.sendRequest(`/user_lifecycle_rules/${encodeURIComponent(params.id)}`, 'PATCH', params, this.options)
|
|
157
145
|
|
|
158
146
|
return new UserLifecycleRule(response?.data, this.options)
|
|
@@ -244,25 +232,14 @@ class UserLifecycleRule {
|
|
|
244
232
|
UserLifecycleRule.find(id, params, options)
|
|
245
233
|
|
|
246
234
|
// Parameters:
|
|
247
|
-
// action
|
|
248
|
-
// authentication_method
|
|
249
|
-
// inactivity_days
|
|
235
|
+
// action - string - Action to take on inactive users (disable or delete)
|
|
236
|
+
// authentication_method - string - User authentication method for the rule
|
|
237
|
+
// inactivity_days - int64 - Number of days of inactivity before the rule applies
|
|
250
238
|
// include_site_admins - boolean - Include site admins in the rule
|
|
251
239
|
// include_folder_admins - boolean - Include folder admins in the rule
|
|
252
240
|
// user_state - string - State of the users to apply the rule to (inactive or disabled)
|
|
241
|
+
// name - string - User Lifecycle Rule name
|
|
253
242
|
static create = async (params = {}, options = {}) => {
|
|
254
|
-
if (!params.action) {
|
|
255
|
-
throw new errors.MissingParameterError('Parameter missing: action')
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
if (!params.authentication_method) {
|
|
259
|
-
throw new errors.MissingParameterError('Parameter missing: authentication_method')
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
if (!params.inactivity_days) {
|
|
263
|
-
throw new errors.MissingParameterError('Parameter missing: inactivity_days')
|
|
264
|
-
}
|
|
265
|
-
|
|
266
243
|
if (params.action && !isString(params.action)) {
|
|
267
244
|
throw new errors.InvalidParameterError(`Bad parameter: action must be of type String, received ${getType(params.action)}`)
|
|
268
245
|
}
|
|
@@ -279,6 +256,10 @@ class UserLifecycleRule {
|
|
|
279
256
|
throw new errors.InvalidParameterError(`Bad parameter: user_state must be of type String, received ${getType(params.user_state)}`)
|
|
280
257
|
}
|
|
281
258
|
|
|
259
|
+
if (params.name && !isString(params.name)) {
|
|
260
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params.name)}`)
|
|
261
|
+
}
|
|
262
|
+
|
|
282
263
|
const response = await Api.sendRequest('/user_lifecycle_rules', 'POST', params, options)
|
|
283
264
|
|
|
284
265
|
return new UserLifecycleRule(response?.data, options)
|