@docbrasil/api-systemmanager 1.1.78 → 1.1.80

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/doc/api.md CHANGED
@@ -1277,6 +1277,7 @@ Admin Class for user, permission admin
1277
1277
  **Kind**: global class
1278
1278
 
1279
1279
  * [AdminUser](#AdminUser)
1280
+ * [.setOrgId(orgId)](#AdminUser+setOrgId) ⇒ [<code>AdminUser</code>](#AdminUser)
1280
1281
  * [.findById(userId, session)](#AdminUser+findById) ⇒ <code>Promise</code>
1281
1282
  * [.findByIds(userIds, apiKey)](#AdminUser+findByIds) ⇒ <code>Promise</code>
1282
1283
  * [.findByIdAndUpdatePassword(params, session)](#AdminUser+findByIdAndUpdatePassword) ⇒ <code>Promise.&lt;unknown&gt;</code>
@@ -1297,6 +1298,19 @@ Admin Class for user, permission admin
1297
1298
  * [.getOrganizations(session)](#AdminUser+getOrganizations) ⇒ <code>Promise.&lt;array&gt;</code>
1298
1299
  * [.getOrgUsers(params, session)](#AdminUser+getOrgUsers) ⇒ <code>Promise.&lt;array&gt;</code>
1299
1300
 
1301
+ <a name="AdminUser+setOrgId"></a>
1302
+
1303
+ ### adminUser.setOrgId(orgId) ⇒ [<code>AdminUser</code>](#AdminUser)
1304
+ Set the organization ID for org-scoped API calls
1305
+
1306
+ **Kind**: instance method of [<code>AdminUser</code>](#AdminUser)
1307
+ **Returns**: [<code>AdminUser</code>](#AdminUser) - this instance for chaining
1308
+ **Access**: public
1309
+
1310
+ | Param | Type | Description |
1311
+ | --- | --- | --- |
1312
+ | orgId | <code>string</code> | Organization ID |
1313
+
1300
1314
  <a name="AdminUser+findById"></a>
1301
1315
 
1302
1316
  ### adminUser.findById(userId, session) ⇒ <code>Promise</code>
@@ -376,7 +376,7 @@
376
376
  <p class="tag-source">
377
377
  <a href="admin_user.js.html" class="button">View Source</a>
378
378
  <span>
379
- <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line424">line 424</a>
379
+ <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line465">line 465</a>
380
380
  </span>
381
381
  </p>
382
382
 
@@ -596,7 +596,7 @@ await api.admin.user.block(userId, session);</code></pre>
596
596
  <p class="tag-source">
597
597
  <a href="admin_user.js.html" class="button">View Source</a>
598
598
  <span>
599
- <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line477">line 477</a>
599
+ <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line518">line 518</a>
600
600
  </span>
601
601
  </p>
602
602
 
@@ -822,7 +822,7 @@ await api.admin.user.block(userId, session);</code></pre>
822
822
  <p class="tag-source">
823
823
  <a href="admin_user.js.html" class="button">View Source</a>
824
824
  <span>
825
- <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line336">line 336</a>
825
+ <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line376">line 376</a>
826
826
  </span>
827
827
  </p>
828
828
 
@@ -1324,7 +1324,7 @@ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';</code></pre>
1324
1324
  <p class="tag-source">
1325
1325
  <a href="admin_user.js.html" class="button">View Source</a>
1326
1326
  <span>
1327
- <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line243">line 243</a>
1327
+ <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line283">line 283</a>
1328
1328
  </span>
1329
1329
  </p>
1330
1330
 
@@ -1550,7 +1550,7 @@ await api.admin.user.create(payload, session);</code></pre>
1550
1550
  <p class="tag-source">
1551
1551
  <a href="admin_user.js.html" class="button">View Source</a>
1552
1552
  <span>
1553
- <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line167">line 167</a>
1553
+ <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line207">line 207</a>
1554
1554
  </span>
1555
1555
  </p>
1556
1556
 
@@ -1745,7 +1745,7 @@ await api.admin.user.emailExist(email, session);</code></pre>
1745
1745
  <p class="tag-source">
1746
1746
  <a href="admin_user.js.html" class="button">View Source</a>
1747
1747
  <span>
1748
- <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line66">line 66</a>
1748
+ <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line106">line 106</a>
1749
1749
  </span>
1750
1750
  </p>
1751
1751
 
@@ -1981,7 +1981,7 @@ await api.admin.user.findById(userId, session);</code></pre>
1981
1981
  <p class="tag-source">
1982
1982
  <a href="admin_user.js.html" class="button">View Source</a>
1983
1983
  <span>
1984
- <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line199">line 199</a>
1984
+ <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line239">line 239</a>
1985
1985
  </span>
1986
1986
  </p>
1987
1987
 
@@ -2272,7 +2272,7 @@ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';</code></pre>
2272
2272
  <p class="tag-source">
2273
2273
  <a href="admin_user.js.html" class="button">View Source</a>
2274
2274
  <span>
2275
- <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line134">line 134</a>
2275
+ <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line174">line 174</a>
2276
2276
  </span>
2277
2277
  </p>
2278
2278
 
@@ -2494,7 +2494,7 @@ await api.admin.user.findByIdAndUpdatePassword(params, session);</code></pre>
2494
2494
  <p class="tag-source">
2495
2495
  <a href="admin_user.js.html" class="button">View Source</a>
2496
2496
  <span>
2497
- <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line97">line 97</a>
2497
+ <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line137">line 137</a>
2498
2498
  </span>
2499
2499
  </p>
2500
2500
 
@@ -2680,7 +2680,7 @@ await api.admin.user.findByIds(userIds, apiKey);</code></pre>
2680
2680
  <p class="tag-source">
2681
2681
  <a href="admin_user.js.html" class="button">View Source</a>
2682
2682
  <span>
2683
- <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line304">line 304</a>
2683
+ <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line344">line 344</a>
2684
2684
  </span>
2685
2685
  </p>
2686
2686
 
@@ -2897,7 +2897,7 @@ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';</code></pre>
2897
2897
  <p class="tag-source">
2898
2898
  <a href="admin_user.js.html" class="button">View Source</a>
2899
2899
  <span>
2900
- <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line565">line 565</a>
2900
+ <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line606">line 606</a>
2901
2901
  </span>
2902
2902
  </p>
2903
2903
 
@@ -3202,7 +3202,7 @@ const groups = await api.admin.user.getGroupsPermissions(orgId, session);</code>
3202
3202
  <p class="tag-source">
3203
3203
  <a href="admin_user.js.html" class="button">View Source</a>
3204
3204
  <span>
3205
- <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line672">line 672</a>
3205
+ <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line713">line 713</a>
3206
3206
  </span>
3207
3207
  </p>
3208
3208
 
@@ -3397,7 +3397,7 @@ const users = await api.admin.user.getOrgUsers(params, session);</code></pre>
3397
3397
  <p class="tag-source">
3398
3398
  <a href="admin_user.js.html" class="button">View Source</a>
3399
3399
  <span>
3400
- <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line641">line 641</a>
3400
+ <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line682">line 682</a>
3401
3401
  </span>
3402
3402
  </p>
3403
3403
 
@@ -3745,7 +3745,7 @@ const orgs = await api.admin.user.getOrganizations(session);</code></pre>
3745
3745
  <p class="tag-source">
3746
3746
  <a href="admin_user.js.html" class="button">View Source</a>
3747
3747
  <span>
3748
- <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line375">line 375</a>
3748
+ <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line415">line 415</a>
3749
3749
  </span>
3750
3750
  </p>
3751
3751
 
@@ -3965,7 +3965,7 @@ await api.user.form.getUserList(params, session);</code></pre>
3965
3965
  <p class="tag-source">
3966
3966
  <a href="admin_user.js.html" class="button">View Source</a>
3967
3967
  <span>
3968
- <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line277">line 277</a>
3968
+ <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line317">line 317</a>
3969
3969
  </span>
3970
3970
  </p>
3971
3971
 
@@ -4027,6 +4027,179 @@ await api.admin.user.remove(userId, session);</code></pre>
4027
4027
 
4028
4028
 
4029
4029
 
4030
+ </div>
4031
+
4032
+ <div class="member">
4033
+
4034
+
4035
+
4036
+ <h4 class="name" id="setOrgId">
4037
+ <a class="href-link" href="#setOrgId">#</a>
4038
+
4039
+ <span class="code-name">
4040
+
4041
+ setOrgId<span class="signature">(orgId)</span><span class="type-signature"> &rarr; {<a href="AdminUser.html">AdminUser</a>}</span>
4042
+
4043
+ </span>
4044
+ </h4>
4045
+
4046
+
4047
+
4048
+
4049
+ <div class="description">
4050
+ Set the organization ID for org-scoped API calls
4051
+ </div>
4052
+
4053
+
4054
+
4055
+
4056
+
4057
+
4058
+
4059
+
4060
+
4061
+
4062
+ <h5>Parameters:</h5>
4063
+
4064
+ <div class="table-container">
4065
+ <table class="params table">
4066
+ <thead>
4067
+ <tr>
4068
+
4069
+ <th>Name</th>
4070
+
4071
+
4072
+ <th>Type</th>
4073
+
4074
+
4075
+
4076
+
4077
+
4078
+ <th class="last">Description</th>
4079
+ </tr>
4080
+ </thead>
4081
+
4082
+ <tbody>
4083
+
4084
+
4085
+
4086
+ <tr class="deep-level-0">
4087
+
4088
+ <td class="name"><code>orgId</code></td>
4089
+
4090
+
4091
+ <td class="type">
4092
+
4093
+
4094
+ <code class="param-type">string</code>
4095
+
4096
+
4097
+
4098
+ </td>
4099
+
4100
+
4101
+
4102
+
4103
+
4104
+ <td class="description last">Organization ID</td>
4105
+ </tr>
4106
+
4107
+
4108
+
4109
+ </tbody>
4110
+ </table>
4111
+ </div>
4112
+
4113
+
4114
+
4115
+
4116
+
4117
+ <dl class="details">
4118
+
4119
+
4120
+
4121
+
4122
+
4123
+
4124
+
4125
+
4126
+
4127
+
4128
+
4129
+
4130
+
4131
+
4132
+
4133
+
4134
+
4135
+
4136
+
4137
+
4138
+
4139
+
4140
+
4141
+
4142
+
4143
+
4144
+
4145
+
4146
+
4147
+
4148
+
4149
+ <p class="tag-source">
4150
+ <a href="admin_user.js.html" class="button">View Source</a>
4151
+ <span>
4152
+ <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line27">line 27</a>
4153
+ </span>
4154
+ </p>
4155
+
4156
+ </dl>
4157
+
4158
+
4159
+
4160
+
4161
+
4162
+
4163
+
4164
+
4165
+
4166
+
4167
+
4168
+
4169
+
4170
+
4171
+
4172
+
4173
+
4174
+
4175
+ <div class='columns method-parameter'>
4176
+ <div class="column is-2"><label>Returns:</label></div>
4177
+ <div class="column is-10">
4178
+
4179
+
4180
+
4181
+ <div class="columns">
4182
+
4183
+ <div class='param-desc column is-7'>this instance for chaining</div>
4184
+
4185
+
4186
+ <div class='column is-5 has-text-left'>
4187
+ <label>Type: </label>
4188
+
4189
+ <code class="param-type"><a href="AdminUser.html">AdminUser</a></code>
4190
+
4191
+
4192
+ </div>
4193
+
4194
+ </div>
4195
+
4196
+
4197
+ </div>
4198
+ </div>
4199
+
4200
+
4201
+
4202
+
4030
4203
  </div>
4031
4204
 
4032
4205
  <div class="member">
@@ -4185,7 +4358,7 @@ await api.admin.user.remove(userId, session);</code></pre>
4185
4358
  <p class="tag-source">
4186
4359
  <a href="admin_user.js.html" class="button">View Source</a>
4187
4360
  <span>
4188
- <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line454">line 454</a>
4361
+ <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line495">line 495</a>
4189
4362
  </span>
4190
4363
  </p>
4191
4364
 
@@ -4405,7 +4578,7 @@ await api.admin.user.unblock(userId, session);</code></pre>
4405
4578
  <p class="tag-source">
4406
4579
  <a href="admin_user.js.html" class="button">View Source</a>
4407
4580
  <span>
4408
- <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line500">line 500</a>
4581
+ <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line541">line 541</a>
4409
4582
  </span>
4410
4583
  </p>
4411
4584
 
@@ -4686,7 +4859,7 @@ await api.admin.user.unblock(userId, session);</code></pre>
4686
4859
  <p class="tag-source">
4687
4860
  <a href="admin_user.js.html" class="button">View Source</a>
4688
4861
  <span>
4689
- <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line605">line 605</a>
4862
+ <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line646">line 646</a>
4690
4863
  </span>
4691
4864
  </p>
4692
4865
 
@@ -4959,7 +5132,7 @@ await api.admin.user.updateUserGroups(params, session);</code></pre>
4959
5132
  <p class="tag-source">
4960
5133
  <a href="admin_user.js.html" class="button">View Source</a>
4961
5134
  <span>
4962
- <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line532">line 532</a>
5135
+ <a href="admin_user.js.html">admin/user.js</a>, <a href="admin_user.js.html#line573">line 573</a>
4963
5136
  </span>
4964
5137
  </p>
4965
5138
 
@@ -102,6 +102,46 @@ class AdminUser {
102
102
  const self = this;
103
103
  self.parent = options.parent;
104
104
  self.client = self.parent.dispatch.getClient();
105
+ self._orgId = null;
106
+ }
107
+
108
+ /**
109
+ * @description Set the organization ID for org-scoped API calls
110
+ * @param {string} orgId - Organization ID
111
+ * @return {AdminUser} this instance for chaining
112
+ * @public
113
+ */
114
+ setOrgId(orgId) {
115
+ this._orgId = orgId;
116
+ return this;
117
+ }
118
+
119
+ /**
120
+ * @description Get the base path for user admin API calls.
121
+ * When orgId is set, uses org-scoped endpoints.
122
+ * When orgId is not set, falls back to legacy admin endpoints.
123
+ * @return {string} base path
124
+ * @private
125
+ */
126
+ _basePath() {
127
+ if (this._orgId) {
128
+ return `/organizations/${this._orgId}/adminusers`;
129
+ }
130
+ return '/admin/users';
131
+ }
132
+
133
+ /**
134
+ * @description Get the base path for org-specific operations (groups, orgchart).
135
+ * When orgId is set, uses org-scoped endpoints.
136
+ * @param {string} orgId - Organization ID for the operation
137
+ * @return {string} base path
138
+ * @private
139
+ */
140
+ _orgPath(orgId) {
141
+ if (this._orgId) {
142
+ return `/organizations/${orgId}/adminusers`;
143
+ }
144
+ return `/admin/organizations/${orgId}`;
105
145
  }
106
146
 
107
147
  /**
@@ -158,7 +198,7 @@ class AdminUser {
158
198
  Joi.assert(userId, Joi.string().required());
159
199
  Joi.assert(session, Joi.string().required());
160
200
 
161
- const apiCall = self.client.get(`/admin/users/${userId}`, self._setHeader(session));
201
+ const apiCall = self.client.get(`${self._basePath()}/${userId}`, self._setHeader(session));
162
202
  return self._returnData(await apiCall);
163
203
  } catch (ex) {
164
204
  throw ex;
@@ -229,7 +269,7 @@ class AdminUser {
229
269
  Joi.assert(session, Joi.string().required());
230
270
 
231
271
  const { userId, ...payload } = params;
232
- const apiCall = self.client.put(`/admin/users/${userId}/password`, payload, self._setHeader(session));
272
+ const apiCall = self.client.put(`${self._basePath()}/${userId}/password`, payload, self._setHeader(session));
233
273
  return self._returnData(await apiCall);
234
274
  } catch (ex) {
235
275
  throw ex;
@@ -259,7 +299,7 @@ class AdminUser {
259
299
  Joi.assert(session, Joi.string().required());
260
300
 
261
301
  const payload = { email };
262
- const apiCall = self.client.post(`/admin/users/email/exist`, payload, self._setHeader(session));
302
+ const apiCall = self.client.post(`${self._basePath()}/email/exist`, payload, self._setHeader(session));
263
303
  return self._returnData(await apiCall);
264
304
  } catch (ex) {
265
305
  throw ex;
@@ -291,7 +331,7 @@ class AdminUser {
291
331
  Joi.assert(payload, Joi.object().required(), 'Payload to update');
292
332
  Joi.assert(session, Joi.string().required(), 'Session user admin');
293
333
 
294
- const apiCall = self.client.put(`/admin/users/${userId}`, payload, self._setHeader(session));
334
+ const apiCall = self.client.put(`${self._basePath()}/${userId}`, payload, self._setHeader(session));
295
335
  return self._returnData(await apiCall);
296
336
  } catch (ex) {
297
337
  throw ex;
@@ -338,7 +378,7 @@ class AdminUser {
338
378
  Joi.assert(payload.orgId, Joi.string().required(), 'Primary organization ID');
339
379
  Joi.assert(session, Joi.string().required(), 'Session token');
340
380
 
341
- const apiCall = self.client.post('/admin/users', payload, self._setHeader(session));
381
+ const apiCall = self.client.put(self._basePath(), payload, self._setHeader(session));
342
382
  return self._returnData(await apiCall);
343
383
  } catch (ex) {
344
384
  throw ex;
@@ -368,7 +408,7 @@ class AdminUser {
368
408
  Joi.assert(userId, Joi.string().required(), 'User ID');
369
409
  Joi.assert(session, Joi.string().required(), 'Session token');
370
410
 
371
- const apiCall = self.client.delete(`/admin/users/${userId}`, self._setHeader(session));
411
+ const apiCall = self.client.delete(`${self._basePath()}/${userId}`, self._setHeader(session));
372
412
  return self._returnData(await apiCall);
373
413
  } catch (ex) {
374
414
  throw ex;
@@ -396,7 +436,7 @@ class AdminUser {
396
436
  Joi.assert(session, Joi.string().required(), 'Session user admin');
397
437
 
398
438
  const payload = { email };
399
- const apiCall = self.client.post('/admin/users/change/password', payload, self._setHeader(session));
439
+ const apiCall = self.client.post(`${self._basePath()}/change/password`, payload, self._setHeader(session));
400
440
 
401
441
  return self._returnData(await apiCall);
402
442
  } catch (ex) {
@@ -429,7 +469,7 @@ class AdminUser {
429
469
  Joi.assert(payload.newPassword, Joi.string().required(), 'New password');
430
470
  Joi.assert(session, Joi.string().required(), 'Session user admin');
431
471
 
432
- const apiCall = self.client.put('/admin/users/change/password', payload, self._setHeader(session));
472
+ const apiCall = self.client.put(`${self._basePath()}/change/password`, payload, self._setHeader(session));
433
473
 
434
474
  return self._returnData(await apiCall);
435
475
  } catch (ex) {
@@ -477,13 +517,14 @@ class AdminUser {
477
517
  page = 1,
478
518
  perPage = 200,
479
519
  project = PROJECTION_DEFAULT,
480
- sort = SORT_DEFAULT
520
+ sort = SORT_DEFAULT,
521
+ filter = {}
481
522
  } = params;
482
523
 
483
- const payloadToSend = {$project: project, sort};
524
+ const payloadToSend = {$project: project, sort, ...filter};
484
525
 
485
526
  const apiCall = self.client
486
- .post(`/admin/users?page=${page}&amp;perPage=${perPage}`, payloadToSend, self._setHeader(session));
527
+ .post(`${self._basePath()}?page=${page}&amp;perPage=${perPage}`, payloadToSend, self._setHeader(session));
487
528
 
488
529
  return self._returnData(await apiCall);
489
530
 
@@ -515,7 +556,7 @@ class AdminUser {
515
556
  Joi.assert(userId, Joi.string().required(), 'User ID');
516
557
  Joi.assert(session, Joi.string().required(), 'Session token');
517
558
 
518
- const apiCall = self.client.put(`/admin/users/${userId}/block`, {}, self._setHeader(session));
559
+ const apiCall = self.client.put(`${self._basePath()}/${userId}/block`, {}, self._setHeader(session));
519
560
  return self._returnData(await apiCall);
520
561
  } catch (ex) {
521
562
  throw ex;
@@ -545,7 +586,7 @@ class AdminUser {
545
586
  Joi.assert(userId, Joi.string().required(), 'User ID');
546
587
  Joi.assert(session, Joi.string().required(), 'Session token');
547
588
 
548
- const apiCall = self.client.put(`/admin/users/${userId}/unblock`, {}, self._setHeader(session));
589
+ const apiCall = self.client.put(`${self._basePath()}/${userId}/unblock`, {}, self._setHeader(session));
549
590
  return self._returnData(await apiCall);
550
591
  } catch (ex) {
551
592
  throw ex;
@@ -568,7 +609,7 @@ class AdminUser {
568
609
  Joi.assert(userId, Joi.string().required(), 'User ID');
569
610
  Joi.assert(session, Joi.string().required(), 'Session token');
570
611
 
571
- const apiCall = self.client.put(`/admin/users/${userId}/blockemail`, {}, self._setHeader(session));
612
+ const apiCall = self.client.put(`${self._basePath()}/${userId}/blockemail`, {}, self._setHeader(session));
572
613
  return self._returnData(await apiCall);
573
614
  } catch (ex) {
574
615
  throw ex;
@@ -591,7 +632,7 @@ class AdminUser {
591
632
  Joi.assert(userId, Joi.string().required(), 'User ID');
592
633
  Joi.assert(session, Joi.string().required(), 'Session token');
593
634
 
594
- const apiCall = self.client.put(`/admin/users/${userId}/unblockemail`, {}, self._setHeader(session));
635
+ const apiCall = self.client.put(`${self._basePath()}/${userId}/unblockemail`, {}, self._setHeader(session));
595
636
  return self._returnData(await apiCall);
596
637
  } catch (ex) {
597
638
  throw ex;
@@ -626,7 +667,7 @@ class AdminUser {
626
667
  Joi.assert(session, Joi.string().required(), 'Session token');
627
668
 
628
669
  const { userId, userType } = params;
629
- const apiCall = self.client.put(`/admin/users/${userId}/type/${userType}`, {}, self._setHeader(session));
670
+ const apiCall = self.client.put(`${self._basePath()}/${userId}/type/${userType}`, {}, self._setHeader(session));
630
671
  return self._returnData(await apiCall);
631
672
  } catch (ex) {
632
673
  throw ex;
@@ -657,7 +698,7 @@ class AdminUser {
657
698
  Joi.assert(session, Joi.string().required(), 'Session token');
658
699
 
659
700
  const apiCall = self.client.get(
660
- `/admin/organizations/${orgId}/orgchart/groups/permissions`,
701
+ `${self._orgPath(orgId)}/groups/permissions`,
661
702
  self._setHeader(session)
662
703
  );
663
704
  return self._returnData(await apiCall);
@@ -701,7 +742,7 @@ class AdminUser {
701
742
 
702
743
  const { orgId, userId, groups } = params;
703
744
  const apiCall = self.client.put(
704
- `/admin/organizations/${orgId}/orgchart/groups/${userId}`,
745
+ `${self._orgPath(orgId)}/groups/${userId}`,
705
746
  { groups },
706
747
  self._setHeader(session)
707
748
  );
@@ -731,7 +772,7 @@ class AdminUser {
731
772
  try {
732
773
  Joi.assert(session, Joi.string().required(), 'Session token');
733
774
 
734
- const apiCall = self.client.get('/admin/users/organizations', self._setHeader(session));
775
+ const apiCall = self.client.get(`${self._basePath()}/organizations`, self._setHeader(session));
735
776
  return self._returnData(await apiCall);
736
777
  } catch (ex) {
737
778
  throw ex;
@@ -765,7 +806,7 @@ class AdminUser {
765
806
  Joi.assert(session, Joi.string().required(), 'Session token');
766
807
 
767
808
  const { orgId, userIds } = params;
768
- let url = `/admin/organizations/${orgId}/orgusers`;
809
+ let url = this._orgId ? `${self._orgPath(orgId)}/orgusers` : `/admin/organizations/${orgId}/orgusers`;
769
810
  if (userIds &amp;&amp; userIds.length > 0) {
770
811
  url += `?userIds=${JSON.stringify(userIds)}`;
771
812
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@docbrasil/api-systemmanager",
3
3
  "description": "Module API System Manager",
4
- "version": "1.1.78",
4
+ "version": "1.1.80",
5
5
  "scripts": {
6
6
  "htmldoc": "rm -rf docs && jsdoc api/** -d docs -t ./node_modules/better-docs",
7
7
  "doc": "rm -rf doc && mkdir doc && jsdoc2md api/**/* api/* > doc/api.md",