@docbrasil/api-systemmanager 1.1.42 → 1.1.44

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/docs/Process.html CHANGED
@@ -1646,6 +1646,252 @@ await api.user.process.getOrgDocTypes(params, session);</code></pre>
1646
1646
 
1647
1647
 
1648
1648
 
1649
+ </div>
1650
+
1651
+ <div class="member">
1652
+
1653
+
1654
+
1655
+ <h4 class="name" id="getOrgGroups">
1656
+ <a class="href-link" href="#getOrgGroups">#</a>
1657
+
1658
+
1659
+ <span class='tag'>async</span>
1660
+
1661
+
1662
+ <span class="code-name">
1663
+
1664
+ getOrgGroups<span class="signature">(params, session)</span><span class="type-signature"> &rarr; {Promise}</span>
1665
+
1666
+ </span>
1667
+ </h4>
1668
+
1669
+
1670
+
1671
+
1672
+ <div class="description">
1673
+ Get Org Groups
1674
+ </div>
1675
+
1676
+
1677
+
1678
+
1679
+
1680
+
1681
+
1682
+
1683
+
1684
+
1685
+ <h5>Parameters:</h5>
1686
+
1687
+ <div class="table-container">
1688
+ <table class="params table">
1689
+ <thead>
1690
+ <tr>
1691
+
1692
+ <th>Name</th>
1693
+
1694
+
1695
+ <th>Type</th>
1696
+
1697
+
1698
+
1699
+
1700
+
1701
+ <th class="last">Description</th>
1702
+ </tr>
1703
+ </thead>
1704
+
1705
+ <tbody>
1706
+
1707
+
1708
+
1709
+ <tr class="deep-level-0">
1710
+
1711
+ <td class="name"><code>params</code></td>
1712
+
1713
+
1714
+ <td class="type">
1715
+
1716
+
1717
+ <code class="param-type">object</code>
1718
+
1719
+
1720
+
1721
+ </td>
1722
+
1723
+
1724
+
1725
+
1726
+
1727
+ <td class="description last">Params to get Org Groups</td>
1728
+ </tr>
1729
+
1730
+
1731
+
1732
+
1733
+ <tr class="deep-level-1">
1734
+
1735
+ <td class="name"><code>orgId</code></td>
1736
+
1737
+
1738
+ <td class="type">
1739
+
1740
+
1741
+ <code class="param-type">string</code>
1742
+
1743
+
1744
+
1745
+ </td>
1746
+
1747
+
1748
+
1749
+
1750
+
1751
+ <td class="description last">Organization id (_id database);</td>
1752
+ </tr>
1753
+
1754
+
1755
+
1756
+
1757
+
1758
+
1759
+
1760
+ <tr class="deep-level-0">
1761
+
1762
+ <td class="name"><code>session</code></td>
1763
+
1764
+
1765
+ <td class="type">
1766
+
1767
+
1768
+ <code class="param-type">string</code>
1769
+
1770
+
1771
+
1772
+ </td>
1773
+
1774
+
1775
+
1776
+
1777
+
1778
+ <td class="description last">Session, token JWT</td>
1779
+ </tr>
1780
+
1781
+
1782
+
1783
+ </tbody>
1784
+ </table>
1785
+ </div>
1786
+
1787
+
1788
+
1789
+
1790
+
1791
+ <dl class="details">
1792
+
1793
+
1794
+
1795
+
1796
+
1797
+
1798
+
1799
+
1800
+
1801
+
1802
+
1803
+
1804
+
1805
+
1806
+
1807
+
1808
+
1809
+
1810
+ <dt class="tag-author">Author:</dt>
1811
+ <dd class="tag-author">
1812
+ <ul>
1813
+ <li><a href="mailto:augusto.pissarra@myndware.com">Myndware</a></li>
1814
+ </ul>
1815
+ </dd>
1816
+
1817
+
1818
+
1819
+
1820
+
1821
+
1822
+
1823
+
1824
+
1825
+
1826
+
1827
+
1828
+
1829
+
1830
+ <p class="tag-source">
1831
+ <a href="user_process.js.html" class="button">View Source</a>
1832
+ <span>
1833
+ <a href="user_process.js.html">user/process.js</a>, <a href="user_process.js.html#line499">line 499</a>
1834
+ </span>
1835
+ </p>
1836
+
1837
+ </dl>
1838
+
1839
+
1840
+
1841
+
1842
+
1843
+
1844
+
1845
+
1846
+
1847
+
1848
+
1849
+
1850
+
1851
+
1852
+
1853
+
1854
+
1855
+
1856
+ <div class='columns method-parameter'>
1857
+ <div class="column is-2"><label>Returns:</label></div>
1858
+ <div class="column is-10">
1859
+
1860
+
1861
+
1862
+ <div class="columns">
1863
+
1864
+
1865
+ <div class='column is-5 has-text-left'>
1866
+ <label>Type: </label>
1867
+
1868
+ <code class="param-type">Promise</code>
1869
+
1870
+
1871
+ </div>
1872
+
1873
+ </div>
1874
+
1875
+
1876
+ </div>
1877
+ </div>
1878
+
1879
+
1880
+
1881
+
1882
+ <h5>Example</h5>
1883
+
1884
+
1885
+ <pre class="prettyprint"><code>const API = require('@docbrasil/api-systemmanager');
1886
+ const api = new API();
1887
+ const params = {
1888
+ orgId: '5edd11c46b6ce9729c2c297c',
1889
+ }
1890
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1891
+ await api.user.process.getOrgGroups(params, session);</code></pre>
1892
+
1893
+
1894
+
1649
1895
  </div>
1650
1896
 
1651
1897
  <div class="member">
@@ -2009,6 +2255,276 @@ const retSearchInfo = await api.user.process.getOrgProcessSearchInfo(params, ses
2009
2255
 
2010
2256
 
2011
2257
 
2258
+ </div>
2259
+
2260
+ <div class="member">
2261
+
2262
+
2263
+
2264
+ <h4 class="name" id="getOrgUsers">
2265
+ <a class="href-link" href="#getOrgUsers">#</a>
2266
+
2267
+
2268
+ <span class='tag'>async</span>
2269
+
2270
+
2271
+ <span class="code-name">
2272
+
2273
+ getOrgUsers<span class="signature">(params, session)</span><span class="type-signature"> &rarr; {Promise}</span>
2274
+
2275
+ </span>
2276
+ </h4>
2277
+
2278
+
2279
+
2280
+
2281
+ <div class="description">
2282
+ Get Org Users
2283
+ </div>
2284
+
2285
+
2286
+
2287
+
2288
+
2289
+
2290
+
2291
+
2292
+
2293
+
2294
+ <h5>Parameters:</h5>
2295
+
2296
+ <div class="table-container">
2297
+ <table class="params table">
2298
+ <thead>
2299
+ <tr>
2300
+
2301
+ <th>Name</th>
2302
+
2303
+
2304
+ <th>Type</th>
2305
+
2306
+
2307
+
2308
+
2309
+
2310
+ <th class="last">Description</th>
2311
+ </tr>
2312
+ </thead>
2313
+
2314
+ <tbody>
2315
+
2316
+
2317
+
2318
+ <tr class="deep-level-0">
2319
+
2320
+ <td class="name"><code>params</code></td>
2321
+
2322
+
2323
+ <td class="type">
2324
+
2325
+
2326
+ <code class="param-type">object</code>
2327
+
2328
+
2329
+
2330
+ </td>
2331
+
2332
+
2333
+
2334
+
2335
+
2336
+ <td class="description last">Params to get Org Users</td>
2337
+ </tr>
2338
+
2339
+
2340
+
2341
+
2342
+ <tr class="deep-level-1">
2343
+
2344
+ <td class="name"><code>orgId</code></td>
2345
+
2346
+
2347
+ <td class="type">
2348
+
2349
+
2350
+ <code class="param-type">string</code>
2351
+
2352
+
2353
+
2354
+ </td>
2355
+
2356
+
2357
+
2358
+
2359
+
2360
+ <td class="description last">Organization id (_id database);</td>
2361
+ </tr>
2362
+
2363
+
2364
+
2365
+ <tr class="deep-level-1">
2366
+
2367
+ <td class="name"><code>userIds</code></td>
2368
+
2369
+
2370
+ <td class="type">
2371
+
2372
+
2373
+ <code class="param-type">array</code>
2374
+
2375
+
2376
+
2377
+ </td>
2378
+
2379
+
2380
+
2381
+
2382
+
2383
+ <td class="description last">UserIds</td>
2384
+ </tr>
2385
+
2386
+
2387
+
2388
+
2389
+
2390
+
2391
+
2392
+ <tr class="deep-level-0">
2393
+
2394
+ <td class="name"><code>session</code></td>
2395
+
2396
+
2397
+ <td class="type">
2398
+
2399
+
2400
+ <code class="param-type">string</code>
2401
+
2402
+
2403
+
2404
+ </td>
2405
+
2406
+
2407
+
2408
+
2409
+
2410
+ <td class="description last">Session, token JWT</td>
2411
+ </tr>
2412
+
2413
+
2414
+
2415
+ </tbody>
2416
+ </table>
2417
+ </div>
2418
+
2419
+
2420
+
2421
+
2422
+
2423
+ <dl class="details">
2424
+
2425
+
2426
+
2427
+
2428
+
2429
+
2430
+
2431
+
2432
+
2433
+
2434
+
2435
+
2436
+
2437
+
2438
+
2439
+
2440
+
2441
+
2442
+ <dt class="tag-author">Author:</dt>
2443
+ <dd class="tag-author">
2444
+ <ul>
2445
+ <li><a href="mailto:augusto.pissarra@myndware.com">Myndware</a></li>
2446
+ </ul>
2447
+ </dd>
2448
+
2449
+
2450
+
2451
+
2452
+
2453
+
2454
+
2455
+
2456
+
2457
+
2458
+
2459
+
2460
+
2461
+
2462
+ <p class="tag-source">
2463
+ <a href="user_process.js.html" class="button">View Source</a>
2464
+ <span>
2465
+ <a href="user_process.js.html">user/process.js</a>, <a href="user_process.js.html#line536">line 536</a>
2466
+ </span>
2467
+ </p>
2468
+
2469
+ </dl>
2470
+
2471
+
2472
+
2473
+
2474
+
2475
+
2476
+
2477
+
2478
+
2479
+
2480
+
2481
+
2482
+
2483
+
2484
+
2485
+
2486
+
2487
+
2488
+ <div class='columns method-parameter'>
2489
+ <div class="column is-2"><label>Returns:</label></div>
2490
+ <div class="column is-10">
2491
+
2492
+
2493
+
2494
+ <div class="columns">
2495
+
2496
+
2497
+ <div class='column is-5 has-text-left'>
2498
+ <label>Type: </label>
2499
+
2500
+ <code class="param-type">Promise</code>
2501
+
2502
+
2503
+ </div>
2504
+
2505
+ </div>
2506
+
2507
+
2508
+ </div>
2509
+ </div>
2510
+
2511
+
2512
+
2513
+
2514
+ <h5>Example</h5>
2515
+
2516
+
2517
+ <pre class="prettyprint"><code>const API = require('@docbrasil/api-systemmanager');
2518
+ const api = new API();
2519
+ const params = {
2520
+ orgId: '5edd11c46b6ce9729c2c297c',
2521
+ userIds: []
2522
+ }
2523
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
2524
+ await api.user.process.getOrgUsers(params, session);</code></pre>
2525
+
2526
+
2527
+
2012
2528
  </div>
2013
2529
 
2014
2530
  <div class="member">
@@ -101,7 +101,7 @@ class Dispatch {
101
101
 
102
102
  const self = this;
103
103
  self.parent = options.parent;
104
- self._client = Axios.create({baseURL: self.parent.options.uri});
104
+ self._client = Axios.create({baseURL: self.parent.options.uri, withCredentials: true});
105
105
  }
106
106
 
107
107
  /**
@@ -526,7 +526,7 @@ class Process {
526
526
  }
527
527
  }
528
528
 
529
- /**
529
+ /**
530
530
  * @author Myndware &lt;augusto.pissarra@myndware.com>
531
531
  * @description Get DocType properties of process
532
532
  * @param {object} params Params to get document DocType
@@ -563,6 +563,83 @@ class Process {
563
563
  throw ex;
564
564
  }
565
565
  }
566
+
567
+ /**
568
+ * @author Myndware &lt;augusto.pissarra@myndware.com>
569
+ * @description Get Org Groups
570
+ * @param {object} params Params to get Org Groups
571
+ * @param {string} params.orgId Organization id (_id database);
572
+ * @param {string} session Session, token JWT
573
+ * @return {Promise}
574
+ * @public
575
+ * @async
576
+ * @example
577
+ *
578
+ * const API = require('@docbrasil/api-systemmanager');
579
+ * const api = new API();
580
+ * const params = {
581
+ * orgId: '5edd11c46b6ce9729c2c297c',
582
+ * }
583
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
584
+ * await api.user.process.getOrgGroups(params, session);
585
+ */
586
+ async getOrgGroups(params, session) {
587
+ const self = this;
588
+
589
+ try {
590
+ Joi.assert(params, Joi.object().required());
591
+ Joi.assert(params.orgId, Joi.string().required());
592
+ Joi.assert(session, Joi.string().required());
593
+
594
+ const {orgId} = params;
595
+ const apiCall = self._client.get(`/organizations/${orgId}/groups`, self._setHeader(session));
596
+ return self._returnData(await apiCall);
597
+ } catch (ex) {
598
+ throw ex;
599
+ }
600
+ }
601
+
602
+ /**
603
+ * @author Myndware &lt;augusto.pissarra@myndware.com>
604
+ * @description Get Org Users
605
+ * @param {object} params Params to get Org Users
606
+ * @param {string} params.orgId Organization id (_id database);
607
+ * @param {array} params.userIds UserIds
608
+ * @param {string} session Session, token JWT
609
+ * @return {Promise}
610
+ * @public
611
+ * @async
612
+ * @example
613
+ *
614
+ * const API = require('@docbrasil/api-systemmanager');
615
+ * const api = new API();
616
+ * const params = {
617
+ * orgId: '5edd11c46b6ce9729c2c297c',
618
+ * userIds: []
619
+ * }
620
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
621
+ * await api.user.process.getOrgUsers(params, session);
622
+ */
623
+ async getOrgUsers(params, session) {
624
+ const self = this;
625
+
626
+ try {
627
+ Joi.assert(params, Joi.object().required());
628
+ Joi.assert(params.orgId, Joi.string().required());
629
+ Joi.assert(params.userIds, Joi.array().required());
630
+ Joi.assert(session, Joi.string().required());
631
+
632
+ const {orgId, userIds} = params;
633
+ let queryString = '';
634
+ if(!_.isEmpty(userIds)) {
635
+ queryString = `?userIds=${JSON.stringify(userIds)}&amp;{"sort":{"name":1}}`;
636
+ }
637
+ const apiCall = self._client.get(`/admin/organizations/${orgId}/orgusers${queryString}`, self._setHeader(session));
638
+ return self._returnData(await apiCall);
639
+ } catch (ex) {
640
+ throw ex;
641
+ }
642
+ }
566
643
  }
567
644
 
568
645
  export default Process;
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.42",
4
+ "version": "1.1.44",
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",
package/.project DELETED
@@ -1,11 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <projectDescription>
3
- <name>api-systemmanager</name>
4
- <comment></comment>
5
- <projects>
6
- </projects>
7
- <buildSpec>
8
- </buildSpec>
9
- <natures>
10
- </natures>
11
- </projectDescription>