@joshuanode/n8n-nodes-cipp 0.0.13 → 0.0.16

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.
Files changed (49) hide show
  1. package/README.md +1 -1
  2. package/dist/nodes/Cipp/Cipp.node.d.ts.map +1 -1
  3. package/dist/nodes/Cipp/Cipp.node.js +1551 -50
  4. package/dist/nodes/Cipp/Cipp.node.js.map +1 -1
  5. package/dist/nodes/Cipp/descriptions/ConditionalAccessDescription.d.ts +4 -0
  6. package/dist/nodes/Cipp/descriptions/ConditionalAccessDescription.d.ts.map +1 -0
  7. package/dist/nodes/Cipp/descriptions/ConditionalAccessDescription.js +413 -0
  8. package/dist/nodes/Cipp/descriptions/ConditionalAccessDescription.js.map +1 -0
  9. package/dist/nodes/Cipp/descriptions/DeviceDescription.d.ts.map +1 -1
  10. package/dist/nodes/Cipp/descriptions/DeviceDescription.js +6 -0
  11. package/dist/nodes/Cipp/descriptions/DeviceDescription.js.map +1 -1
  12. package/dist/nodes/Cipp/descriptions/EmailSecurityDescription.d.ts +4 -0
  13. package/dist/nodes/Cipp/descriptions/EmailSecurityDescription.d.ts.map +1 -0
  14. package/dist/nodes/Cipp/descriptions/EmailSecurityDescription.js +347 -0
  15. package/dist/nodes/Cipp/descriptions/EmailSecurityDescription.js.map +1 -0
  16. package/dist/nodes/Cipp/descriptions/ExchangeResourceDescription.d.ts +4 -0
  17. package/dist/nodes/Cipp/descriptions/ExchangeResourceDescription.d.ts.map +1 -0
  18. package/dist/nodes/Cipp/descriptions/ExchangeResourceDescription.js +249 -0
  19. package/dist/nodes/Cipp/descriptions/ExchangeResourceDescription.js.map +1 -0
  20. package/dist/nodes/Cipp/descriptions/IntuneDescription.d.ts +4 -0
  21. package/dist/nodes/Cipp/descriptions/IntuneDescription.d.ts.map +1 -0
  22. package/dist/nodes/Cipp/descriptions/IntuneDescription.js +250 -0
  23. package/dist/nodes/Cipp/descriptions/IntuneDescription.js.map +1 -0
  24. package/dist/nodes/Cipp/descriptions/MailboxDescription.d.ts.map +1 -1
  25. package/dist/nodes/Cipp/descriptions/MailboxDescription.js +1094 -6
  26. package/dist/nodes/Cipp/descriptions/MailboxDescription.js.map +1 -1
  27. package/dist/nodes/Cipp/descriptions/SafeLinksDescription.d.ts +4 -0
  28. package/dist/nodes/Cipp/descriptions/SafeLinksDescription.d.ts.map +1 -0
  29. package/dist/nodes/Cipp/descriptions/SafeLinksDescription.js +201 -0
  30. package/dist/nodes/Cipp/descriptions/SafeLinksDescription.js.map +1 -0
  31. package/dist/nodes/Cipp/descriptions/SharePointDescription.d.ts +4 -0
  32. package/dist/nodes/Cipp/descriptions/SharePointDescription.d.ts.map +1 -0
  33. package/dist/nodes/Cipp/descriptions/SharePointDescription.js +129 -0
  34. package/dist/nodes/Cipp/descriptions/SharePointDescription.js.map +1 -0
  35. package/dist/nodes/Cipp/descriptions/StandardsDescription.d.ts +4 -0
  36. package/dist/nodes/Cipp/descriptions/StandardsDescription.d.ts.map +1 -0
  37. package/dist/nodes/Cipp/descriptions/StandardsDescription.js +288 -0
  38. package/dist/nodes/Cipp/descriptions/StandardsDescription.js.map +1 -0
  39. package/dist/nodes/Cipp/descriptions/TestingDescription.d.ts +4 -0
  40. package/dist/nodes/Cipp/descriptions/TestingDescription.d.ts.map +1 -0
  41. package/dist/nodes/Cipp/descriptions/TestingDescription.js +170 -0
  42. package/dist/nodes/Cipp/descriptions/TestingDescription.js.map +1 -0
  43. package/dist/nodes/Cipp/descriptions/UserDescription.d.ts.map +1 -1
  44. package/dist/nodes/Cipp/descriptions/UserDescription.js +135 -2
  45. package/dist/nodes/Cipp/descriptions/UserDescription.js.map +1 -1
  46. package/dist/nodes/Cipp/descriptions/index.d.ts.map +1 -1
  47. package/dist/nodes/Cipp/descriptions/index.js +24 -0
  48. package/dist/nodes/Cipp/descriptions/index.js.map +1 -1
  49. package/package.json +1 -1
@@ -52,11 +52,26 @@ class Cipp {
52
52
  value: 'backup',
53
53
  description: 'Manage CIPP backups',
54
54
  },
55
+ {
56
+ name: 'Conditional Access',
57
+ value: 'conditionalAccess',
58
+ description: 'Manage conditional access policies and named locations',
59
+ },
55
60
  {
56
61
  name: 'Device',
57
62
  value: 'device',
58
63
  description: 'Manage Intune devices',
59
64
  },
65
+ {
66
+ name: 'Email Security',
67
+ value: 'emailSecurity',
68
+ description: 'Manage spam filters, transport rules, connectors, and email security policies',
69
+ },
70
+ {
71
+ name: 'Exchange Resource',
72
+ value: 'exchangeResource',
73
+ description: 'Manage Exchange rooms, equipment, and room lists',
74
+ },
60
75
  {
61
76
  name: 'GDAP',
62
77
  value: 'gdap',
@@ -72,6 +87,11 @@ class Cipp {
72
87
  value: 'identity',
73
88
  description: 'Manage audit logs, roles, and deleted items',
74
89
  },
90
+ {
91
+ name: 'Intune',
92
+ value: 'intune',
93
+ description: 'Manage Intune scripts, compliance policies, assignment filters, and reusable settings',
94
+ },
75
95
  {
76
96
  name: 'Mailbox',
77
97
  value: 'mailbox',
@@ -92,11 +112,26 @@ class Cipp {
92
112
  value: 'quarantine',
93
113
  description: 'Manage quarantined email messages',
94
114
  },
115
+ {
116
+ name: 'Safe Links',
117
+ value: 'safeLinks',
118
+ description: 'Manage Safe Links policies and templates',
119
+ },
95
120
  {
96
121
  name: 'Scheduled Item',
97
122
  value: 'scheduledItem',
98
123
  description: 'Manage scheduled jobs',
99
124
  },
125
+ {
126
+ name: 'SharePoint',
127
+ value: 'sharepoint',
128
+ description: 'Manage SharePoint sites, quotas, and settings',
129
+ },
130
+ {
131
+ name: 'Standards',
132
+ value: 'standards',
133
+ description: 'Manage tenant standards, drift, BPA, and domain analyser',
134
+ },
100
135
  {
101
136
  name: 'Team',
102
137
  value: 'team',
@@ -107,6 +142,11 @@ class Cipp {
107
142
  value: 'teamsShift',
108
143
  description: 'Manage Teams Shifts schedule — shifts, open shifts, groups, time off',
109
144
  },
145
+ {
146
+ name: 'Testing',
147
+ value: 'testing',
148
+ description: 'Manage test runs, test reports, and available tests',
149
+ },
110
150
  {
111
151
  name: 'Tenant',
112
152
  value: 'tenant',
@@ -374,13 +414,27 @@ class Cipp {
374
414
  const lastName = this.getNodeParameter('lastName', i);
375
415
  const domain = this.getNodeParameter('domain', i);
376
416
  const additionalFields = this.getNodeParameter('additionalFields', i, {});
417
+ // Map to the field names CIPP's /api/AddUser (New-CIPPUser) expects:
418
+ // - givenName (not firstName)
419
+ // - surname (not lastName)
420
+ // - username (used for mailNickname + UPN prefix)
421
+ // - primDomain (object with .value, or Domain as plain string)
377
422
  const body = {
378
423
  tenantFilter,
379
- firstName,
380
- lastName,
381
- domain,
382
- ...additionalFields,
424
+ givenName: additionalFields.givenName || firstName,
425
+ surname: additionalFields.surname || lastName,
426
+ displayName: additionalFields.displayName || `${firstName} ${lastName}`,
427
+ username: additionalFields.username || additionalFields.mailNickname || firstName.toLowerCase(),
428
+ mailNickname: additionalFields.mailNickname || additionalFields.username || firstName.toLowerCase(),
429
+ Domain: domain,
430
+ usageLocation: additionalFields.usageLocation || 'US',
383
431
  };
432
+ // Spread remaining additionalFields (but don't overwrite mapped fields)
433
+ for (const [key, value] of Object.entries(additionalFields)) {
434
+ if (!body[key] && value !== undefined && value !== '') {
435
+ body[key] = value;
436
+ }
437
+ }
384
438
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddUser', body, {});
385
439
  }
386
440
  else if (operation === 'disable' || operation === 'enable') {
@@ -508,6 +562,108 @@ class Cipp {
508
562
  Role: jitAdminRole,
509
563
  }, {});
510
564
  }
565
+ else if (operation === 'listUserDevices') {
566
+ const returnAll = this.getNodeParameter('returnAll', i);
567
+ const userId = this.getNodeParameter('userId', i);
568
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListUserDevices', {}, { tenantFilter, userId });
569
+ if (Array.isArray(responseData) && !returnAll) {
570
+ const limit = this.getNodeParameter('limit', i);
571
+ responseData = responseData.slice(0, limit);
572
+ }
573
+ }
574
+ else if (operation === 'listUserGroups') {
575
+ const returnAll = this.getNodeParameter('returnAll', i);
576
+ const userId = this.getNodeParameter('userId', i);
577
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListUserGroups', {}, { tenantFilter, userId });
578
+ if (Array.isArray(responseData) && !returnAll) {
579
+ const limit = this.getNodeParameter('limit', i);
580
+ responseData = responseData.slice(0, limit);
581
+ }
582
+ }
583
+ else if (operation === 'listUserMailboxDetails') {
584
+ const returnAll = this.getNodeParameter('returnAll', i);
585
+ const userId = this.getNodeParameter('userId', i);
586
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListUserMailboxDetails', {}, { tenantFilter, UserID: userId });
587
+ if (Array.isArray(responseData) && !returnAll) {
588
+ const limit = this.getNodeParameter('limit', i);
589
+ responseData = responseData.slice(0, limit);
590
+ }
591
+ }
592
+ else if (operation === 'listUserPhoto') {
593
+ const returnAll = this.getNodeParameter('returnAll', i);
594
+ const userId = this.getNodeParameter('userId', i);
595
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListUserPhoto', {}, { tenantFilter, userId });
596
+ if (Array.isArray(responseData) && !returnAll) {
597
+ const limit = this.getNodeParameter('limit', i);
598
+ responseData = responseData.slice(0, limit);
599
+ }
600
+ }
601
+ else if (operation === 'listUserCAPolicies') {
602
+ const returnAll = this.getNodeParameter('returnAll', i);
603
+ const userId = this.getNodeParameter('userId', i);
604
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListUserConditionalAccessPolicies', {}, { tenantFilter, userId });
605
+ if (Array.isArray(responseData) && !returnAll) {
606
+ const limit = this.getNodeParameter('limit', i);
607
+ responseData = responseData.slice(0, limit);
608
+ }
609
+ }
610
+ else if (operation === 'listUserSettings') {
611
+ const returnAll = this.getNodeParameter('returnAll', i);
612
+ const userId = this.getNodeParameter('userId', i);
613
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListUserSettings', {}, { tenantFilter, userId });
614
+ if (Array.isArray(responseData) && !returnAll) {
615
+ const limit = this.getNodeParameter('limit', i);
616
+ responseData = responseData.slice(0, limit);
617
+ }
618
+ }
619
+ else if (operation === 'listPerUserMfa') {
620
+ const returnAll = this.getNodeParameter('returnAll', i);
621
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListPerUserMFA', {}, { tenantFilter });
622
+ if (Array.isArray(responseData) && !returnAll) {
623
+ const limit = this.getNodeParameter('limit', i);
624
+ responseData = responseData.slice(0, limit);
625
+ }
626
+ }
627
+ else if (operation === 'listUserCounts') {
628
+ const returnAll = this.getNodeParameter('returnAll', i);
629
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListUserCounts', {}, { tenantFilter });
630
+ if (Array.isArray(responseData) && !returnAll) {
631
+ const limit = this.getNodeParameter('limit', i);
632
+ responseData = responseData.slice(0, limit);
633
+ }
634
+ }
635
+ else if (operation === 'addGuest') {
636
+ const displayName = this.getNodeParameter('guestDisplayName', i);
637
+ const mail = this.getNodeParameter('guestMail', i);
638
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddGuest', {
639
+ tenantFilter,
640
+ displayName,
641
+ mail,
642
+ }, {});
643
+ }
644
+ else if (operation === 'setUserPhoto') {
645
+ const userId = this.getNodeParameter('userId', i);
646
+ const photo = this.getNodeParameter('photo', i);
647
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecSetUserPhoto', {
648
+ tenantFilter,
649
+ userId,
650
+ photo,
651
+ }, {});
652
+ }
653
+ else if (operation === 'bulkLicense') {
654
+ const licenseJson = this.getNodeParameter('licenseJson', i);
655
+ let parsedLicense;
656
+ try {
657
+ parsedLicense = JSON.parse(typeof licenseJson === 'string' ? licenseJson : '{}');
658
+ }
659
+ catch (e) {
660
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'License JSON must be valid JSON', { itemIndex: i });
661
+ }
662
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecBulkLicense', {
663
+ ...parsedLicense,
664
+ tenantFilter,
665
+ }, {});
666
+ }
511
667
  }
512
668
  // ==================== GROUP ====================
513
669
  else if (resource === 'group') {
@@ -598,6 +754,143 @@ class Cipp {
598
754
  }, {});
599
755
  }
600
756
  }
757
+ // ==================== CONDITIONAL ACCESS ====================
758
+ else if (resource === 'conditionalAccess') {
759
+ const tenantFilter = getTenantFilter();
760
+ if (operation === 'listPolicies') {
761
+ const returnAll = this.getNodeParameter('returnAll', i);
762
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListConditionalAccessPolicies', {}, { tenantFilter });
763
+ if (Array.isArray(responseData) && !returnAll) {
764
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
765
+ }
766
+ }
767
+ else if (operation === 'listTemplates') {
768
+ const returnAll = this.getNodeParameter('returnAll', i);
769
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListCAtemplates', {}, {});
770
+ if (Array.isArray(responseData) && !returnAll) {
771
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
772
+ }
773
+ }
774
+ else if (operation === 'listNamedLocations') {
775
+ const returnAll = this.getNodeParameter('returnAll', i);
776
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListNamedLocations', {}, { tenantFilter });
777
+ if (Array.isArray(responseData) && !returnAll) {
778
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
779
+ }
780
+ }
781
+ else if (operation === 'addPolicy') {
782
+ const policyJson = this.getNodeParameter('caPolicyJson', i);
783
+ const caState = this.getNodeParameter('caState', i);
784
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddCAPolicy', {
785
+ tenantFilter: { value: [tenantFilter] },
786
+ RawJSON: policyJson,
787
+ NewState: caState || 'donotchange',
788
+ }, {});
789
+ }
790
+ else if (operation === 'editPolicy') {
791
+ const policyId = this.getNodeParameter('policyId', i);
792
+ const editState = this.getNodeParameter('editCaState', i);
793
+ const body = {
794
+ tenantFilter,
795
+ GUID: policyId,
796
+ };
797
+ if (editState)
798
+ body.State = editState;
799
+ const editJson = this.getNodeParameter('editPolicyJson', i);
800
+ let editData;
801
+ try {
802
+ editData = JSON.parse(editJson);
803
+ }
804
+ catch (e) {
805
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Policy JSON must be valid JSON', { itemIndex: i });
806
+ }
807
+ if (editData.displayName)
808
+ body.newDisplayName = editData.displayName;
809
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditCAPolicy', body, {});
810
+ }
811
+ else if (operation === 'removePolicy') {
812
+ const policyId = this.getNodeParameter('policyId', i);
813
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/RemoveCAPolicy', {
814
+ tenantFilter,
815
+ GUID: policyId,
816
+ }, {});
817
+ }
818
+ else if (operation === 'addTemplate') {
819
+ const templateJson = this.getNodeParameter('caTemplateJson', i);
820
+ let templateData;
821
+ try {
822
+ templateData = JSON.parse(templateJson);
823
+ }
824
+ catch (e) {
825
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Template JSON must be valid JSON', { itemIndex: i });
826
+ }
827
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddCATemplate', {
828
+ tenantFilter,
829
+ ...templateData,
830
+ }, {});
831
+ }
832
+ else if (operation === 'removeTemplate') {
833
+ const templateId = this.getNodeParameter('caTemplateId', i);
834
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/RemoveCATemplate', {
835
+ ID: templateId,
836
+ }, {});
837
+ }
838
+ else if (operation === 'caCheck') {
839
+ const userId = this.getNodeParameter('caCheckUserId', i);
840
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecCACheck', {
841
+ tenantFilter,
842
+ userID: { value: userId },
843
+ }, {});
844
+ }
845
+ else if (operation === 'addNamedLocation') {
846
+ const locationName = this.getNodeParameter('namedLocationName', i);
847
+ const locationType = this.getNodeParameter('namedLocationType', i);
848
+ const body = {
849
+ selectedTenants: { value: [tenantFilter] },
850
+ policyName: locationName,
851
+ };
852
+ if (locationType === 'ip') {
853
+ const ipRanges = this.getNodeParameter('namedLocationIpRanges', i);
854
+ const trusted = this.getNodeParameter('namedLocationTrusted', i);
855
+ body.Type = 'IPLocation';
856
+ body.Ips = ipRanges.split(',').map((r) => r.trim()).join('\n');
857
+ body.Trusted = trusted;
858
+ }
859
+ else {
860
+ const countries = this.getNodeParameter('namedLocationCountries', i);
861
+ body.Type = 'CountryLocation';
862
+ body.Countries = { value: countries.split(',').map((c) => c.trim()) };
863
+ }
864
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddNamedLocation', body, {});
865
+ }
866
+ else if (operation === 'manageNamedLocation') {
867
+ const locationId = this.getNodeParameter('namedLocationId', i);
868
+ const action = this.getNodeParameter('namedLocationAction', i);
869
+ if (action === 'Delete') {
870
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecNamedLocation', {
871
+ tenantFilter,
872
+ namedLocationId: locationId,
873
+ change: 'Delete',
874
+ }, {});
875
+ }
876
+ else {
877
+ const locationJson = this.getNodeParameter('namedLocationJson', i);
878
+ let locationData;
879
+ try {
880
+ locationData = JSON.parse(locationJson);
881
+ }
882
+ catch (e) {
883
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Location JSON must be valid JSON', { itemIndex: i });
884
+ }
885
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecNamedLocation', {
886
+ tenantFilter,
887
+ namedLocationId: locationId,
888
+ change: 'Update',
889
+ input: locationData,
890
+ }, {});
891
+ }
892
+ }
893
+ }
601
894
  // ==================== DEVICE ====================
602
895
  else if (resource === 'device') {
603
896
  const tenantFilter = getTenantFilter();
@@ -682,12 +975,122 @@ class Cipp {
682
975
  const configType = this.getNodeParameter('configType', i);
683
976
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListAutopilotConfig', {}, { tenantFilter, type: configType });
684
977
  }
978
+ else if (operation === 'syncDep') {
979
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecSyncDEP', { tenantFilter }, {});
980
+ }
685
981
  }
686
982
  // ==================== MAILBOX ====================
687
983
  else if (resource === 'mailbox') {
688
984
  const tenantFilter = getTenantFilter();
689
- const userId = this.getNodeParameter('userId', i);
690
- if (operation === 'convert') {
985
+ // ---------- List operations (no userId required) ----------
986
+ if (operation === 'listMailboxes') {
987
+ const returnAll = this.getNodeParameter('returnAll', i);
988
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListMailboxes', {}, { tenantFilter });
989
+ if (Array.isArray(responseData) && !returnAll) {
990
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
991
+ }
992
+ }
993
+ else if (operation === 'listMailboxForwarding') {
994
+ const returnAll = this.getNodeParameter('returnAll', i);
995
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListMailboxForwarding', {}, { tenantFilter });
996
+ if (Array.isArray(responseData) && !returnAll) {
997
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
998
+ }
999
+ }
1000
+ else if (operation === 'listRestrictedUsers') {
1001
+ const returnAll = this.getNodeParameter('returnAll', i);
1002
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListRestrictedUsers', {}, { tenantFilter });
1003
+ if (Array.isArray(responseData) && !returnAll) {
1004
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
1005
+ }
1006
+ }
1007
+ else if (operation === 'listSharedMailboxStatistics') {
1008
+ const returnAll = this.getNodeParameter('returnAll', i);
1009
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListSharedMailboxStatistics', {}, { tenantFilter });
1010
+ if (Array.isArray(responseData) && !returnAll) {
1011
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
1012
+ }
1013
+ }
1014
+ else if (operation === 'listSharedMailboxAccountEnabled') {
1015
+ const returnAll = this.getNodeParameter('returnAll', i);
1016
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListSharedMailboxAccountEnabled', {}, { tenantFilter });
1017
+ if (Array.isArray(responseData) && !returnAll) {
1018
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
1019
+ }
1020
+ // ---------- List operations (userId required) ----------
1021
+ }
1022
+ else if (operation === 'listMailboxDetails') {
1023
+ const userId = this.getNodeParameter('userId', i);
1024
+ const returnAll = this.getNodeParameter('returnAll', i);
1025
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListUserMailboxDetails', {}, { tenantFilter, UserID: userId });
1026
+ if (Array.isArray(responseData) && !returnAll) {
1027
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
1028
+ }
1029
+ }
1030
+ else if (operation === 'listMailboxRules') {
1031
+ const userId = this.getNodeParameter('userId', i);
1032
+ const returnAll = this.getNodeParameter('returnAll', i);
1033
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListMailboxRules', {}, { tenantFilter, userId });
1034
+ if (Array.isArray(responseData) && !returnAll) {
1035
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
1036
+ }
1037
+ }
1038
+ else if (operation === 'listMailboxMobileDevices') {
1039
+ const userId = this.getNodeParameter('userId', i);
1040
+ const returnAll = this.getNodeParameter('returnAll', i);
1041
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListMailboxMobileDevices', {}, { tenantFilter, Mailbox: userId });
1042
+ if (Array.isArray(responseData) && !returnAll) {
1043
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
1044
+ }
1045
+ }
1046
+ else if (operation === 'listMailboxCAS') {
1047
+ const returnAll = this.getNodeParameter('returnAll', i);
1048
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListMailboxCAS', {}, { TenantFilter: tenantFilter });
1049
+ if (Array.isArray(responseData) && !returnAll) {
1050
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
1051
+ }
1052
+ }
1053
+ else if (operation === 'listCalendarPermissions') {
1054
+ const userId = this.getNodeParameter('userId', i);
1055
+ const returnAll = this.getNodeParameter('returnAll', i);
1056
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListCalendarPermissions', {}, { tenantFilter, UserID: userId });
1057
+ if (Array.isArray(responseData) && !returnAll) {
1058
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
1059
+ }
1060
+ }
1061
+ else if (operation === 'listContactPermissions') {
1062
+ const userId = this.getNodeParameter('userId', i);
1063
+ const returnAll = this.getNodeParameter('returnAll', i);
1064
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListContactPermissions', {}, { tenantFilter, UserID: userId });
1065
+ if (Array.isArray(responseData) && !returnAll) {
1066
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
1067
+ }
1068
+ }
1069
+ else if (operation === 'listOoO') {
1070
+ const userId = this.getNodeParameter('userId', i);
1071
+ const returnAll = this.getNodeParameter('returnAll', i);
1072
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListOoO', {}, { tenantFilter, userid: userId });
1073
+ if (Array.isArray(responseData) && !returnAll) {
1074
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
1075
+ }
1076
+ // ---------- Add Shared Mailbox ----------
1077
+ }
1078
+ else if (operation === 'addSharedMailbox') {
1079
+ const displayName = this.getNodeParameter('displayName', i);
1080
+ const username = this.getNodeParameter('username', i);
1081
+ const domain = this.getNodeParameter('domain', i);
1082
+ const additionalFields = this.getNodeParameter('additionalFields', i, {});
1083
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddSharedMailbox', {
1084
+ tenantID: tenantFilter,
1085
+ displayName,
1086
+ username,
1087
+ domain,
1088
+ ...additionalFields,
1089
+ }, {});
1090
+ // ---------- Existing operations ----------
1091
+ }
1092
+ else if (operation === 'convert') {
1093
+ const userId = this.getNodeParameter('userId', i);
691
1094
  const mailboxType = this.getNodeParameter('mailboxType', i);
692
1095
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecConvertMailbox', {
693
1096
  tenantFilter,
@@ -696,12 +1099,14 @@ class Cipp {
696
1099
  }, {});
697
1100
  }
698
1101
  else if (operation === 'enableArchive') {
1102
+ const userId = this.getNodeParameter('userId', i);
699
1103
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecEnableArchive', {
700
1104
  tenantFilter,
701
1105
  ID: userId,
702
1106
  }, {});
703
1107
  }
704
1108
  else if (operation === 'setOutOfOffice') {
1109
+ const userId = this.getNodeParameter('userId', i);
705
1110
  const autoReplyState = this.getNodeParameter('autoReplyState', i);
706
1111
  const body = {
707
1112
  tenantFilter,
@@ -714,6 +1119,7 @@ class Cipp {
714
1119
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecSetOOO', body, {});
715
1120
  }
716
1121
  else if (operation === 'setForwarding') {
1122
+ const userId = this.getNodeParameter('userId', i);
717
1123
  const forwardTo = this.getNodeParameter('forwardTo', i);
718
1124
  const keepCopy = this.getNodeParameter('keepCopy', i);
719
1125
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecEmailForward', {
@@ -722,61 +1128,375 @@ class Cipp {
722
1128
  ForwardTo: forwardTo,
723
1129
  KeepCopy: keepCopy,
724
1130
  }, {});
1131
+ // ---------- Edit Mailbox Permissions ----------
725
1132
  }
726
- }
727
- // ==================== QUARANTINE ====================
728
- else if (resource === 'quarantine') {
729
- const tenantFilter = getTenantFilter();
730
- if (operation === 'getMany') {
731
- const returnAll = this.getNodeParameter('returnAll', i);
732
- responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListMailQuarantine', {}, { tenantFilter });
733
- if (Array.isArray(responseData) && !returnAll) {
734
- const limit = this.getNodeParameter('limit', i);
735
- responseData = responseData.slice(0, limit);
736
- }
1133
+ else if (operation === 'editMailboxPermissions') {
1134
+ const userId = this.getNodeParameter('userId', i);
1135
+ const permissions = this.getNodeParameter('permissions', i, {});
1136
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecEditMailboxPermissions', {
1137
+ tenantfilter: tenantFilter,
1138
+ userID: userId,
1139
+ ...permissions,
1140
+ }, {});
1141
+ // ---------- Edit Calendar Permissions ----------
737
1142
  }
738
- else if (operation === 'release') {
739
- const messageId = this.getNodeParameter('messageId', i);
740
- const allowSender = this.getNodeParameter('allowSender', i);
741
- responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecQuarantineManagement', {
1143
+ else if (operation === 'editCalendarPermissions') {
1144
+ const userId = this.getNodeParameter('userId', i);
1145
+ const userToModify = this.getNodeParameter('userToModify', i);
1146
+ const permissionLevel = this.getNodeParameter('permissionLevel', i);
1147
+ const folderName = this.getNodeParameter('folderName', i);
1148
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecEditCalendarPermissions', {
742
1149
  tenantFilter,
743
- ID: messageId,
744
- Type: 'Release',
745
- AllowSender: allowSender,
1150
+ userid: userId,
1151
+ UserToGetPermissions: userToModify,
1152
+ Permissions: permissionLevel,
1153
+ FolderName: folderName,
746
1154
  }, {});
1155
+ // ---------- Modify Contact Permissions ----------
747
1156
  }
748
- else if (operation === 'deny') {
749
- const messageId = this.getNodeParameter('messageId', i);
750
- responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecQuarantineManagement', {
1157
+ else if (operation === 'modifyContactPerms') {
1158
+ const userId = this.getNodeParameter('userId', i);
1159
+ const contactUserToModify = this.getNodeParameter('contactUserToModify', i);
1160
+ const contactPermissionLevel = this.getNodeParameter('contactPermissionLevel', i);
1161
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecModifyContactPerms', {
751
1162
  tenantFilter,
752
- ID: messageId,
753
- Type: 'Deny',
1163
+ UserID: userId,
1164
+ UserToGetPermissions: contactUserToModify,
1165
+ Permissions: contactPermissionLevel,
754
1166
  }, {});
1167
+ // ---------- Mailbox Rules ----------
755
1168
  }
756
- else if (operation === 'getMessage') {
757
- const messageId = this.getNodeParameter('messageId', i);
758
- responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListMailQuarantineMessage', {}, {
759
- tenantFilter,
760
- Identity: messageId,
761
- });
1169
+ else if (operation === 'removeMailboxRule') {
1170
+ const userId = this.getNodeParameter('userId', i);
1171
+ const ruleName = this.getNodeParameter('ruleName', i);
1172
+ const ruleId = this.getNodeParameter('ruleId', i);
1173
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecRemoveMailboxRule', {
1174
+ TenantFilter: tenantFilter,
1175
+ userPrincipalName: userId,
1176
+ ruleName,
1177
+ ruleId,
1178
+ }, {});
762
1179
  }
763
- }
764
- // ==================== ALERT ====================
765
- else if (resource === 'alert') {
766
- if (operation === 'getAll') {
767
- const returnAll = this.getNodeParameter('returnAll', i);
768
- responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListAlertsQueue', {}, {});
769
- if (Array.isArray(responseData) && !returnAll) {
770
- const limit = this.getNodeParameter('limit', i);
771
- responseData = responseData.slice(0, limit);
1180
+ else if (operation === 'setMailboxRule') {
1181
+ const userId = this.getNodeParameter('userId', i);
1182
+ const setRuleName = this.getNodeParameter('setRuleName', i);
1183
+ const setRuleId = this.getNodeParameter('setRuleId', i);
1184
+ const ruleAction = this.getNodeParameter('ruleAction', i);
1185
+ const body = {
1186
+ TenantFilter: tenantFilter,
1187
+ userPrincipalName: userId,
1188
+ ruleName: setRuleName,
1189
+ ruleId: setRuleId,
1190
+ };
1191
+ if (ruleAction === 'Enable') {
1192
+ body.Enable = true;
772
1193
  }
1194
+ else {
1195
+ body.Disable = true;
1196
+ }
1197
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecSetMailboxRule', body, {});
1198
+ // ---------- Set Mailbox Quota ----------
773
1199
  }
774
- else if (operation === 'add') {
775
- const alertConfig = this.getNodeParameter('alertConfig', i);
776
- responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddAlert', JSON.parse(alertConfig), {});
777
- }
778
- else if (operation === 'getSecurityAlerts') {
779
- const tenantFilter = getTenantFilter();
1200
+ else if (operation === 'setMailboxQuota') {
1201
+ const userId = this.getNodeParameter('userId', i);
1202
+ const quotaType = this.getNodeParameter('quotaType', i);
1203
+ const quotaValue = this.getNodeParameter('quotaValue', i);
1204
+ const body = {
1205
+ tenantfilter: tenantFilter,
1206
+ user: userId,
1207
+ quota: quotaValue,
1208
+ };
1209
+ body[quotaType] = true;
1210
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecSetMailboxQuota', body, {});
1211
+ // ---------- Set Litigation Hold ----------
1212
+ }
1213
+ else if (operation === 'setLitigationHold') {
1214
+ const userId = this.getNodeParameter('userId', i);
1215
+ const enabled = this.getNodeParameter('litigationHoldEnabled', i);
1216
+ const body = {
1217
+ tenantFilter,
1218
+ Identity: userId,
1219
+ UPN: userId,
1220
+ };
1221
+ if (!enabled) {
1222
+ body.disable = true;
1223
+ }
1224
+ else {
1225
+ const duration = this.getNodeParameter('litigationHoldDuration', i);
1226
+ if (duration > 0)
1227
+ body.days = duration;
1228
+ }
1229
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecSetLitigationHold', body, {});
1230
+ // ---------- Set Mailbox Email Size ----------
1231
+ }
1232
+ else if (operation === 'setMailboxEmailSize') {
1233
+ const userId = this.getNodeParameter('userId', i);
1234
+ const maxSendSize = this.getNodeParameter('maxSendSize', i);
1235
+ const maxReceiveSize = this.getNodeParameter('maxReceiveSize', i);
1236
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecSetMailboxEmailSize', {
1237
+ tenantFilter,
1238
+ UPN: userId,
1239
+ id: userId,
1240
+ maxSendSize: String(maxSendSize),
1241
+ maxReceiveSize: String(maxReceiveSize),
1242
+ }, {});
1243
+ // ---------- Set Mailbox Locale ----------
1244
+ }
1245
+ else if (operation === 'setMailboxLocale') {
1246
+ const userId = this.getNodeParameter('userId', i);
1247
+ const language = this.getNodeParameter('language', i);
1248
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecSetMailboxLocale', {
1249
+ tenantFilter,
1250
+ user: userId,
1251
+ locale: language,
1252
+ }, {});
1253
+ // ---------- Set Retention Hold ----------
1254
+ }
1255
+ else if (operation === 'setRetentionHold') {
1256
+ const userId = this.getNodeParameter('userId', i);
1257
+ const enabled = this.getNodeParameter('retentionHoldEnabled', i);
1258
+ const retentionBody = {
1259
+ tenantFilter,
1260
+ Identity: userId,
1261
+ UPN: userId,
1262
+ };
1263
+ if (!enabled) {
1264
+ retentionBody.disable = true;
1265
+ }
1266
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecSetRetentionHold', retentionBody, {});
1267
+ // ---------- Set Recipient Limits ----------
1268
+ }
1269
+ else if (operation === 'setRecipientLimits') {
1270
+ const userId = this.getNodeParameter('userId', i);
1271
+ const recipientLimit = this.getNodeParameter('recipientLimit', i);
1272
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecSetRecipientLimits', {
1273
+ tenantFilter,
1274
+ Identity: userId,
1275
+ userid: userId,
1276
+ recipientLimit,
1277
+ }, {});
1278
+ // ---------- Copy for Sent ----------
1279
+ }
1280
+ else if (operation === 'copyForSent') {
1281
+ const userId = this.getNodeParameter('userId', i);
1282
+ const enabled = this.getNodeParameter('copyForSentEnabled', i);
1283
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecCopyForSent', {
1284
+ tenantFilter,
1285
+ ID: userId,
1286
+ messageCopyState: String(enabled),
1287
+ }, {});
1288
+ // ---------- Hide From GAL ----------
1289
+ }
1290
+ else if (operation === 'hideFromGAL') {
1291
+ const userId = this.getNodeParameter('userId', i);
1292
+ const hidden = this.getNodeParameter('hiddenFromGAL', i);
1293
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecHideFromGAL', {
1294
+ tenantFilter,
1295
+ ID: userId,
1296
+ HideFromGAL: String(hidden),
1297
+ }, {});
1298
+ // ---------- Manage Mobile Devices ----------
1299
+ }
1300
+ else if (operation === 'mailboxMobileDevices') {
1301
+ const userId = this.getNodeParameter('userId', i);
1302
+ const deviceGuid = this.getNodeParameter('deviceGuid', i);
1303
+ const deviceId = this.getNodeParameter('deviceId', i);
1304
+ const mobileAction = this.getNodeParameter('mobileAction', i);
1305
+ const qs = {
1306
+ tenantfilter: tenantFilter,
1307
+ Userid: userId,
1308
+ guid: deviceGuid,
1309
+ deviceid: deviceId,
1310
+ };
1311
+ if (mobileAction === 'Quarantine') {
1312
+ qs.Quarantine = 'true';
1313
+ }
1314
+ else if (mobileAction === 'Delete') {
1315
+ qs.Delete = 'true';
1316
+ }
1317
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ExecMailboxMobileDevices', {}, qs);
1318
+ // ---------- Start Managed Folder Assistant ----------
1319
+ }
1320
+ else if (operation === 'startManagedFolderAssistant') {
1321
+ const userId = this.getNodeParameter('userId', i);
1322
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecStartManagedFolderAssistant', {
1323
+ tenantFilter,
1324
+ Id: userId,
1325
+ UserPrincipalName: userId,
1326
+ }, {});
1327
+ // ---------- Enable Auto-Expanding Archive ----------
1328
+ }
1329
+ else if (operation === 'enableAutoExpandingArchive') {
1330
+ const userId = this.getNodeParameter('userId', i);
1331
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecEnableAutoExpandingArchive', {
1332
+ tenantFilter,
1333
+ ID: userId,
1334
+ username: userId,
1335
+ }, {});
1336
+ // ---------- High Volume Email ----------
1337
+ }
1338
+ else if (operation === 'hveUser') {
1339
+ const hveDisplayName = this.getNodeParameter('hveDisplayName', i);
1340
+ const hvePrimarySMTPAddress = this.getNodeParameter('hvePrimarySMTPAddress', i);
1341
+ const hvePassword = this.getNodeParameter('hvePassword', i);
1342
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecHVEUser', {
1343
+ TenantFilter: tenantFilter,
1344
+ displayName: hveDisplayName,
1345
+ primarySMTPAddress: hvePrimarySMTPAddress,
1346
+ password: hvePassword,
1347
+ }, {});
1348
+ // ---------- Schedule Mailbox Vacation ----------
1349
+ }
1350
+ else if (operation === 'scheduleMailboxVacation') {
1351
+ const userId = this.getNodeParameter('userId', i);
1352
+ const startDate = this.getNodeParameter('vacationStartDate', i);
1353
+ const endDate = this.getNodeParameter('vacationEndDate', i);
1354
+ const vacationOptions = this.getNodeParameter('vacationOptions', i, {});
1355
+ const body = {
1356
+ tenantFilter,
1357
+ mailboxOwners: [{ value: userId }],
1358
+ startDate: new Date(startDate).getTime(),
1359
+ endDate: new Date(endDate).getTime(),
1360
+ };
1361
+ if (vacationOptions.ForwardTo) {
1362
+ body.delegates = [{ value: vacationOptions.ForwardTo }];
1363
+ }
1364
+ if (vacationOptions.KeepCopy !== undefined)
1365
+ body.autoMap = vacationOptions.KeepCopy;
1366
+ if (vacationOptions.CalendarAccessUser) {
1367
+ body.includeCalendar = true;
1368
+ body.calendarPermission = vacationOptions.CalendarPermission || 'Reviewer';
1369
+ body.canViewPrivateItems = false;
1370
+ }
1371
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecScheduleMailboxVacation', body, {});
1372
+ // ---------- Schedule OOO Vacation ----------
1373
+ }
1374
+ else if (operation === 'scheduleOOOVacation') {
1375
+ const userId = this.getNodeParameter('userId', i);
1376
+ const startDate = this.getNodeParameter('oooStartDate', i);
1377
+ const endDate = this.getNodeParameter('oooEndDate', i);
1378
+ const internalMessage = this.getNodeParameter('oooInternalMessage', i);
1379
+ const body = {
1380
+ tenantFilter,
1381
+ Users: [{ value: userId }],
1382
+ startDate: new Date(startDate).getTime(),
1383
+ endDate: new Date(endDate).getTime(),
1384
+ internalMessage,
1385
+ };
1386
+ const externalMessage = this.getNodeParameter('oooExternalMessage', i, '');
1387
+ if (externalMessage) {
1388
+ body.externalMessage = externalMessage;
1389
+ }
1390
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecScheduleOOOVacation', body, {});
1391
+ // ---------- Manage Retention Policies ----------
1392
+ }
1393
+ else if (operation === 'manageRetentionPolicies') {
1394
+ const action = this.getNodeParameter('retentionPolicyAction', i);
1395
+ if (action === 'List') {
1396
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ExecManageRetentionPolicies', {}, { tenantFilter });
1397
+ }
1398
+ else {
1399
+ const policyName = this.getNodeParameter('retentionPolicyName', i);
1400
+ const body = { tenantFilter };
1401
+ if (action === 'Create') {
1402
+ body.CreatePolicies = [{ Name: policyName }];
1403
+ }
1404
+ else if (action === 'Delete') {
1405
+ body.DeletePolicies = [policyName];
1406
+ }
1407
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecManageRetentionPolicies', body, {});
1408
+ }
1409
+ // ---------- Manage Retention Tags ----------
1410
+ }
1411
+ else if (operation === 'manageRetentionTags') {
1412
+ const action = this.getNodeParameter('retentionTagAction', i);
1413
+ if (action === 'List') {
1414
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ExecManageRetentionTags', {}, { tenantFilter });
1415
+ }
1416
+ else {
1417
+ const tagName = this.getNodeParameter('retentionTagName', i);
1418
+ const body = { tenantFilter };
1419
+ if (action === 'Create') {
1420
+ body.CreateTags = [{ Name: tagName }];
1421
+ }
1422
+ else if (action === 'Delete') {
1423
+ body.DeleteTags = [tagName];
1424
+ }
1425
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecManageRetentionTags', body, {});
1426
+ }
1427
+ // ---------- Set Mailbox Retention Policy ----------
1428
+ }
1429
+ else if (operation === 'setMailboxRetentionPolicies') {
1430
+ const userId = this.getNodeParameter('userId', i);
1431
+ const policyName = this.getNodeParameter('retentionPolicyToSet', i);
1432
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecSetMailboxRetentionPolicies', {
1433
+ tenantFilter,
1434
+ PolicyName: policyName,
1435
+ Mailboxes: [userId],
1436
+ }, {});
1437
+ // ---------- Remove Restricted User ----------
1438
+ }
1439
+ else if (operation === 'removeRestrictedUser') {
1440
+ const userId = this.getNodeParameter('userId', i);
1441
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecRemoveRestrictedUser', {
1442
+ tenantFilter,
1443
+ SenderAddress: userId,
1444
+ }, {});
1445
+ }
1446
+ }
1447
+ // ==================== QUARANTINE ====================
1448
+ else if (resource === 'quarantine') {
1449
+ const tenantFilter = getTenantFilter();
1450
+ if (operation === 'getMany') {
1451
+ const returnAll = this.getNodeParameter('returnAll', i);
1452
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListMailQuarantine', {}, { tenantFilter });
1453
+ if (Array.isArray(responseData) && !returnAll) {
1454
+ const limit = this.getNodeParameter('limit', i);
1455
+ responseData = responseData.slice(0, limit);
1456
+ }
1457
+ }
1458
+ else if (operation === 'release') {
1459
+ const messageId = this.getNodeParameter('messageId', i);
1460
+ const allowSender = this.getNodeParameter('allowSender', i);
1461
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecQuarantineManagement', {
1462
+ tenantFilter,
1463
+ ID: messageId,
1464
+ Type: 'Release',
1465
+ AllowSender: allowSender,
1466
+ }, {});
1467
+ }
1468
+ else if (operation === 'deny') {
1469
+ const messageId = this.getNodeParameter('messageId', i);
1470
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecQuarantineManagement', {
1471
+ tenantFilter,
1472
+ ID: messageId,
1473
+ Type: 'Deny',
1474
+ }, {});
1475
+ }
1476
+ else if (operation === 'getMessage') {
1477
+ const messageId = this.getNodeParameter('messageId', i);
1478
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListMailQuarantineMessage', {}, {
1479
+ tenantFilter,
1480
+ Identity: messageId,
1481
+ });
1482
+ }
1483
+ }
1484
+ // ==================== ALERT ====================
1485
+ else if (resource === 'alert') {
1486
+ if (operation === 'getAll') {
1487
+ const returnAll = this.getNodeParameter('returnAll', i);
1488
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListAlertsQueue', {}, {});
1489
+ if (Array.isArray(responseData) && !returnAll) {
1490
+ const limit = this.getNodeParameter('limit', i);
1491
+ responseData = responseData.slice(0, limit);
1492
+ }
1493
+ }
1494
+ else if (operation === 'add') {
1495
+ const alertConfig = this.getNodeParameter('alertConfig', i);
1496
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddAlert', JSON.parse(alertConfig), {});
1497
+ }
1498
+ else if (operation === 'getSecurityAlerts') {
1499
+ const tenantFilter = getTenantFilter();
780
1500
  const returnAll = this.getNodeParameter('returnAll', i);
781
1501
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ExecAlertsList', {}, { tenantFilter });
782
1502
  if (Array.isArray(responseData) && !returnAll) {
@@ -1096,6 +1816,106 @@ class Cipp {
1096
1816
  }, {});
1097
1817
  }
1098
1818
  }
1819
+ // ==================== SAFE LINKS ====================
1820
+ else if (resource === 'safeLinks') {
1821
+ const tenantFilter = getTenantFilter();
1822
+ if (operation === 'listPolicies') {
1823
+ const returnAll = this.getNodeParameter('returnAll', i);
1824
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListSafeLinksPolicy', {}, { tenantFilter });
1825
+ if (Array.isArray(responseData) && !returnAll) {
1826
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
1827
+ }
1828
+ }
1829
+ else if (operation === 'listTemplates') {
1830
+ const returnAll = this.getNodeParameter('returnAll', i);
1831
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListSafeLinksPolicyTemplates', {}, {});
1832
+ if (Array.isArray(responseData) && !returnAll) {
1833
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
1834
+ }
1835
+ }
1836
+ else if (operation === 'addPolicy') {
1837
+ const policyName = this.getNodeParameter('slPolicyName', i);
1838
+ const policyJson = this.getNodeParameter('slPolicyJson', i);
1839
+ let policyData;
1840
+ try {
1841
+ policyData = JSON.parse(policyJson);
1842
+ }
1843
+ catch (e) {
1844
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Policy JSON must be valid JSON', { itemIndex: i });
1845
+ }
1846
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecNewSafeLinksPolicy', {
1847
+ ...policyData,
1848
+ tenantFilter,
1849
+ Name: policyName,
1850
+ }, {});
1851
+ }
1852
+ else if (operation === 'editPolicy') {
1853
+ const policyName = this.getNodeParameter('slPolicyName', i);
1854
+ const policyJson = this.getNodeParameter('slPolicyJson', i);
1855
+ let policyData;
1856
+ try {
1857
+ policyData = JSON.parse(policyJson);
1858
+ }
1859
+ catch (e) {
1860
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Policy JSON must be valid JSON', { itemIndex: i });
1861
+ }
1862
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditSafeLinksPolicy', {
1863
+ ...policyData,
1864
+ tenantFilter,
1865
+ Name: policyName,
1866
+ }, {});
1867
+ }
1868
+ else if (operation === 'deletePolicy') {
1869
+ const policyName = this.getNodeParameter('slPolicyName', i);
1870
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecDeleteSafeLinksPolicy', {
1871
+ tenantFilter,
1872
+ Name: policyName,
1873
+ }, {});
1874
+ }
1875
+ else if (operation === 'addTemplate') {
1876
+ const templateName = this.getNodeParameter('slTemplateName', i);
1877
+ const templateJson = this.getNodeParameter('slTemplateJson', i);
1878
+ let templateData;
1879
+ try {
1880
+ templateData = JSON.parse(templateJson);
1881
+ }
1882
+ catch (e) {
1883
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Template JSON must be valid JSON', { itemIndex: i });
1884
+ }
1885
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddSafeLinksPolicyTemplate', {
1886
+ ...templateData,
1887
+ Name: templateName,
1888
+ }, {});
1889
+ }
1890
+ else if (operation === 'editTemplate') {
1891
+ const templateName = this.getNodeParameter('slTemplateName', i);
1892
+ const templateJson = this.getNodeParameter('slTemplateJson', i);
1893
+ let templateData;
1894
+ try {
1895
+ templateData = JSON.parse(templateJson);
1896
+ }
1897
+ catch (e) {
1898
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Template JSON must be valid JSON', { itemIndex: i });
1899
+ }
1900
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditSafeLinksPolicyTemplate', {
1901
+ ...templateData,
1902
+ Name: templateName,
1903
+ }, {});
1904
+ }
1905
+ else if (operation === 'removeTemplate') {
1906
+ const templateName = this.getNodeParameter('slTemplateName', i);
1907
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/RemoveSafeLinksPolicyTemplate', {
1908
+ Name: templateName,
1909
+ }, {});
1910
+ }
1911
+ else if (operation === 'addFromTemplate') {
1912
+ const templateName = this.getNodeParameter('slTemplateName', i);
1913
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddSafeLinksPolicyFromTemplate', {
1914
+ tenantFilter,
1915
+ TemplateName: templateName,
1916
+ }, {});
1917
+ }
1918
+ }
1099
1919
  // ==================== SCHEDULED ITEM ====================
1100
1920
  else if (resource === 'scheduledItem') {
1101
1921
  if (operation === 'getAll') {
@@ -1616,6 +2436,352 @@ class Cipp {
1616
2436
  }, {});
1617
2437
  }
1618
2438
  }
2439
+ // ==================== EMAIL SECURITY ====================
2440
+ else if (resource === 'emailSecurity') {
2441
+ const tenantFilter = getTenantFilter();
2442
+ if (operation === 'listSpamFilters') {
2443
+ const returnAll = this.getNodeParameter('returnAll', i);
2444
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListSpamfilter', {}, { tenantFilter });
2445
+ if (Array.isArray(responseData) && !returnAll) {
2446
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2447
+ }
2448
+ }
2449
+ else if (operation === 'addSpamFilter') {
2450
+ const policyJson = this.getNodeParameter('esSpamFilterJson', i);
2451
+ let policyData;
2452
+ try {
2453
+ policyData = JSON.parse(policyJson);
2454
+ }
2455
+ catch (e) {
2456
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Policy JSON must be valid JSON', { itemIndex: i });
2457
+ }
2458
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddSpamFilter', {
2459
+ ...policyData,
2460
+ tenantFilter,
2461
+ }, {});
2462
+ }
2463
+ else if (operation === 'editSpamFilter') {
2464
+ const policyJson = this.getNodeParameter('esSpamFilterJson', i);
2465
+ let policyData;
2466
+ try {
2467
+ policyData = JSON.parse(policyJson);
2468
+ }
2469
+ catch (e) {
2470
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Policy JSON must be valid JSON', { itemIndex: i });
2471
+ }
2472
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditSpamFilter', {
2473
+ ...policyData,
2474
+ tenantFilter,
2475
+ }, {});
2476
+ }
2477
+ else if (operation === 'removeSpamFilter') {
2478
+ const name = this.getNodeParameter('esName', i);
2479
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/RemoveSpamfilter', {
2480
+ tenantFilter,
2481
+ Name: name,
2482
+ }, {});
2483
+ }
2484
+ else if (operation === 'listTransportRules') {
2485
+ const returnAll = this.getNodeParameter('returnAll', i);
2486
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListTransportRules', {}, { tenantFilter });
2487
+ if (Array.isArray(responseData) && !returnAll) {
2488
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2489
+ }
2490
+ }
2491
+ else if (operation === 'addTransportRule') {
2492
+ const ruleJson = this.getNodeParameter('esTransportRuleJson', i);
2493
+ let ruleData;
2494
+ try {
2495
+ ruleData = JSON.parse(ruleJson);
2496
+ }
2497
+ catch (e) {
2498
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Rule JSON must be valid JSON', { itemIndex: i });
2499
+ }
2500
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddTransportRule', {
2501
+ ...ruleData,
2502
+ tenantFilter,
2503
+ }, {});
2504
+ }
2505
+ else if (operation === 'editTransportRule') {
2506
+ const ruleJson = this.getNodeParameter('esTransportRuleJson', i);
2507
+ let ruleData;
2508
+ try {
2509
+ ruleData = JSON.parse(ruleJson);
2510
+ }
2511
+ catch (e) {
2512
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Rule JSON must be valid JSON', { itemIndex: i });
2513
+ }
2514
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditTransportRule', {
2515
+ ...ruleData,
2516
+ tenantFilter,
2517
+ }, {});
2518
+ }
2519
+ else if (operation === 'removeTransportRule') {
2520
+ const name = this.getNodeParameter('esName', i);
2521
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/RemoveTransportRule', {
2522
+ tenantFilter,
2523
+ Name: name,
2524
+ }, {});
2525
+ }
2526
+ else if (operation === 'listExchangeConnectors') {
2527
+ const returnAll = this.getNodeParameter('returnAll', i);
2528
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListExchangeConnectors', {}, { tenantFilter });
2529
+ if (Array.isArray(responseData) && !returnAll) {
2530
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2531
+ }
2532
+ }
2533
+ else if (operation === 'addExConnector') {
2534
+ const connectorJson = this.getNodeParameter('esConnectorJson', i);
2535
+ let connectorData;
2536
+ try {
2537
+ connectorData = JSON.parse(connectorJson);
2538
+ }
2539
+ catch (e) {
2540
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Connector JSON must be valid JSON', { itemIndex: i });
2541
+ }
2542
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddExConnector', {
2543
+ ...connectorData,
2544
+ tenantFilter,
2545
+ }, {});
2546
+ }
2547
+ else if (operation === 'editExConnector') {
2548
+ const connectorJson = this.getNodeParameter('esConnectorJson', i);
2549
+ let connectorData;
2550
+ try {
2551
+ connectorData = JSON.parse(connectorJson);
2552
+ }
2553
+ catch (e) {
2554
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Connector JSON must be valid JSON', { itemIndex: i });
2555
+ }
2556
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditExConnector', {
2557
+ ...connectorData,
2558
+ tenantFilter,
2559
+ }, {});
2560
+ }
2561
+ else if (operation === 'removeExConnector') {
2562
+ const name = this.getNodeParameter('esName', i);
2563
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/RemoveExConnector', {
2564
+ tenantFilter,
2565
+ Name: name,
2566
+ }, {});
2567
+ }
2568
+ else if (operation === 'listConnectionFilters') {
2569
+ const returnAll = this.getNodeParameter('returnAll', i);
2570
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListConnectionFilter', {}, { tenantFilter });
2571
+ if (Array.isArray(responseData) && !returnAll) {
2572
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2573
+ }
2574
+ }
2575
+ else if (operation === 'addConnectionFilter') {
2576
+ const filterJson = this.getNodeParameter('esConnectionFilterJson', i);
2577
+ let filterData;
2578
+ try {
2579
+ filterData = JSON.parse(filterJson);
2580
+ }
2581
+ catch (e) {
2582
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Filter JSON must be valid JSON', { itemIndex: i });
2583
+ }
2584
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddConnectionFilter', {
2585
+ ...filterData,
2586
+ tenantFilter,
2587
+ }, {});
2588
+ }
2589
+ else if (operation === 'listAntiPhishingFilters') {
2590
+ const returnAll = this.getNodeParameter('returnAll', i);
2591
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListAntiPhishingFilters', {}, { tenantFilter });
2592
+ if (Array.isArray(responseData) && !returnAll) {
2593
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2594
+ }
2595
+ }
2596
+ else if (operation === 'editAntiPhishingFilter') {
2597
+ const filterJson = this.getNodeParameter('esAntiPhishingFilterJson', i);
2598
+ let filterData;
2599
+ try {
2600
+ filterData = JSON.parse(filterJson);
2601
+ }
2602
+ catch (e) {
2603
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Filter JSON must be valid JSON', { itemIndex: i });
2604
+ }
2605
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditAntiPhishingFilter', {
2606
+ ...filterData,
2607
+ tenantFilter,
2608
+ }, {});
2609
+ }
2610
+ else if (operation === 'listMalwareFilters') {
2611
+ const returnAll = this.getNodeParameter('returnAll', i);
2612
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListMalwareFilters', {}, { tenantFilter });
2613
+ if (Array.isArray(responseData) && !returnAll) {
2614
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2615
+ }
2616
+ }
2617
+ else if (operation === 'editMalwareFilter') {
2618
+ const filterJson = this.getNodeParameter('esMalwareFilterJson', i);
2619
+ let filterData;
2620
+ try {
2621
+ filterData = JSON.parse(filterJson);
2622
+ }
2623
+ catch (e) {
2624
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Filter JSON must be valid JSON', { itemIndex: i });
2625
+ }
2626
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditMalwareFilter', {
2627
+ ...filterData,
2628
+ tenantFilter,
2629
+ }, {});
2630
+ }
2631
+ else if (operation === 'listSafeAttachmentsFilters') {
2632
+ const returnAll = this.getNodeParameter('returnAll', i);
2633
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListSafeAttachmentsFilters', {}, { tenantFilter });
2634
+ if (Array.isArray(responseData) && !returnAll) {
2635
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2636
+ }
2637
+ }
2638
+ else if (operation === 'addTenantAllowBlockList') {
2639
+ const blockListJson = this.getNodeParameter('esBlockListJson', i);
2640
+ let blockListData;
2641
+ try {
2642
+ blockListData = JSON.parse(blockListJson);
2643
+ }
2644
+ catch (e) {
2645
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Block List JSON must be valid JSON', { itemIndex: i });
2646
+ }
2647
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddTenantAllowBlockList', {
2648
+ ...blockListData,
2649
+ tenantFilter,
2650
+ }, {});
2651
+ }
2652
+ else if (operation === 'removeTenantAllowBlockList') {
2653
+ const blockListJson = this.getNodeParameter('esBlockListJson', i);
2654
+ let blockListData;
2655
+ try {
2656
+ blockListData = JSON.parse(blockListJson);
2657
+ }
2658
+ catch (e) {
2659
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Block List JSON must be valid JSON', { itemIndex: i });
2660
+ }
2661
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/RemoveTenantAllowBlockList', {
2662
+ ...blockListData,
2663
+ tenantFilter,
2664
+ }, {});
2665
+ }
2666
+ else if (operation === 'listTenantAllowBlockList') {
2667
+ const returnAll = this.getNodeParameter('returnAll', i);
2668
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListTenantAllowBlockList', {}, { tenantFilter });
2669
+ if (Array.isArray(responseData) && !returnAll) {
2670
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2671
+ }
2672
+ }
2673
+ }
2674
+ // ==================== EXCHANGE RESOURCE ====================
2675
+ else if (resource === 'exchangeResource') {
2676
+ const tenantFilter = getTenantFilter();
2677
+ if (operation === 'listRooms') {
2678
+ const returnAll = this.getNodeParameter('returnAll', i);
2679
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListRooms', {}, { tenantFilter });
2680
+ if (Array.isArray(responseData) && !returnAll) {
2681
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2682
+ }
2683
+ }
2684
+ else if (operation === 'addRoomMailbox') {
2685
+ const displayName = this.getNodeParameter('erDisplayName', i);
2686
+ const username = this.getNodeParameter('erUsername', i);
2687
+ const domain = this.getNodeParameter('erDomain', i);
2688
+ const additionalJson = this.getNodeParameter('erAdditionalJson', i);
2689
+ let additionalData = {};
2690
+ if (additionalJson && additionalJson !== '{}') {
2691
+ try {
2692
+ additionalData = JSON.parse(additionalJson);
2693
+ }
2694
+ catch (e) {
2695
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Additional JSON must be valid JSON', { itemIndex: i });
2696
+ }
2697
+ }
2698
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddRoomMailbox', {
2699
+ ...additionalData,
2700
+ tenantFilter,
2701
+ displayName,
2702
+ username,
2703
+ domain,
2704
+ }, {});
2705
+ }
2706
+ else if (operation === 'editRoomMailbox') {
2707
+ const roomJson = this.getNodeParameter('erRoomJson', i);
2708
+ let roomData;
2709
+ try {
2710
+ roomData = JSON.parse(roomJson);
2711
+ }
2712
+ catch (e) {
2713
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Room JSON must be valid JSON', { itemIndex: i });
2714
+ }
2715
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditRoomMailbox', {
2716
+ ...roomData,
2717
+ tenantFilter,
2718
+ }, {});
2719
+ }
2720
+ else if (operation === 'listEquipment') {
2721
+ const returnAll = this.getNodeParameter('returnAll', i);
2722
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListEquipment', {}, { tenantFilter });
2723
+ if (Array.isArray(responseData) && !returnAll) {
2724
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2725
+ }
2726
+ }
2727
+ else if (operation === 'addEquipmentMailbox') {
2728
+ const displayName = this.getNodeParameter('erDisplayName', i);
2729
+ const username = this.getNodeParameter('erUsername', i);
2730
+ const domain = this.getNodeParameter('erDomain', i);
2731
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddEquipmentMailbox', {
2732
+ tenantFilter,
2733
+ displayName,
2734
+ username,
2735
+ domain,
2736
+ }, {});
2737
+ }
2738
+ else if (operation === 'editEquipmentMailbox') {
2739
+ const equipmentJson = this.getNodeParameter('erEquipmentJson', i);
2740
+ let equipmentData;
2741
+ try {
2742
+ equipmentData = JSON.parse(equipmentJson);
2743
+ }
2744
+ catch (e) {
2745
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Equipment JSON must be valid JSON', { itemIndex: i });
2746
+ }
2747
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditEquipmentMailbox', {
2748
+ ...equipmentData,
2749
+ tenantFilter,
2750
+ }, {});
2751
+ }
2752
+ else if (operation === 'listRoomLists') {
2753
+ const returnAll = this.getNodeParameter('returnAll', i);
2754
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListRoomLists', {}, { tenantFilter });
2755
+ if (Array.isArray(responseData) && !returnAll) {
2756
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2757
+ }
2758
+ }
2759
+ else if (operation === 'addRoomList') {
2760
+ const displayName = this.getNodeParameter('erDisplayName', i);
2761
+ const username = this.getNodeParameter('erUsername', i);
2762
+ const domain = this.getNodeParameter('erDomain', i);
2763
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddRoomList', {
2764
+ tenantFilter,
2765
+ displayName,
2766
+ username,
2767
+ domain,
2768
+ }, {});
2769
+ }
2770
+ else if (operation === 'editRoomList') {
2771
+ const roomListJson = this.getNodeParameter('erRoomListJson', i);
2772
+ let roomListData;
2773
+ try {
2774
+ roomListData = JSON.parse(roomListJson);
2775
+ }
2776
+ catch (e) {
2777
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Room List JSON must be valid JSON', { itemIndex: i });
2778
+ }
2779
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditRoomList', {
2780
+ ...roomListData,
2781
+ tenantFilter,
2782
+ }, {});
2783
+ }
2784
+ }
1619
2785
  // ==================== GDAP ====================
1620
2786
  else if (resource === 'gdap') {
1621
2787
  const tenantFilter = getTenantFilter();
@@ -1635,6 +2801,341 @@ class Cipp {
1635
2801
  }, {});
1636
2802
  }
1637
2803
  }
2804
+ // ==================== STANDARDS ====================
2805
+ else if (resource === 'standards') {
2806
+ const tenantFilter = (['listStandardTemplates', 'addStandardTemplate', 'removeStandardTemplate', 'listDomainHealth'].includes(operation))
2807
+ ? undefined
2808
+ : getTenantFilter();
2809
+ if (operation === 'listStandards') {
2810
+ const returnAll = this.getNodeParameter('returnAll', i);
2811
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListStandards', {}, { tenantFilter });
2812
+ if (Array.isArray(responseData) && !returnAll) {
2813
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2814
+ }
2815
+ }
2816
+ else if (operation === 'addStandardsDeploy') {
2817
+ const standardsJson = this.getNodeParameter('standardsJson', i);
2818
+ let standardsData;
2819
+ try {
2820
+ standardsData = JSON.parse(standardsJson);
2821
+ }
2822
+ catch (e) {
2823
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Standards JSON must be valid JSON', { itemIndex: i });
2824
+ }
2825
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddStandardsDeploy', {
2826
+ ...standardsData,
2827
+ tenantFilter,
2828
+ }, {});
2829
+ }
2830
+ else if (operation === 'removeStandard') {
2831
+ const standardId = this.getNodeParameter('standardId', i);
2832
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/RemoveStandard', {
2833
+ tenantFilter,
2834
+ ID: standardId,
2835
+ }, {});
2836
+ }
2837
+ else if (operation === 'listStandardTemplates') {
2838
+ const returnAll = this.getNodeParameter('returnAll', i);
2839
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/listStandardTemplates', {}, {});
2840
+ if (Array.isArray(responseData) && !returnAll) {
2841
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2842
+ }
2843
+ }
2844
+ else if (operation === 'addStandardTemplate') {
2845
+ const templateJson = this.getNodeParameter('standardTemplateJson', i);
2846
+ let templateData;
2847
+ try {
2848
+ templateData = JSON.parse(templateJson);
2849
+ }
2850
+ catch (e) {
2851
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Template JSON must be valid JSON', { itemIndex: i });
2852
+ }
2853
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddStandardsTemplate', {
2854
+ ...templateData,
2855
+ }, {});
2856
+ }
2857
+ else if (operation === 'removeStandardTemplate') {
2858
+ const templateId = this.getNodeParameter('standardTemplateId', i);
2859
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/RemoveStandardTemplate', {
2860
+ ID: templateId,
2861
+ }, {});
2862
+ }
2863
+ else if (operation === 'runStandards') {
2864
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecStandardsRun', {
2865
+ tenantFilter,
2866
+ }, {});
2867
+ }
2868
+ else if (operation === 'listBPA') {
2869
+ const returnAll = this.getNodeParameter('returnAll', i);
2870
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListBPA', {}, { tenantFilter });
2871
+ if (Array.isArray(responseData) && !returnAll) {
2872
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2873
+ }
2874
+ }
2875
+ else if (operation === 'execBPA') {
2876
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecBPA', {
2877
+ tenantFilter,
2878
+ }, {});
2879
+ }
2880
+ else if (operation === 'listDomainAnalyser') {
2881
+ const returnAll = this.getNodeParameter('returnAll', i);
2882
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListDomainAnalyser', {}, { tenantFilter });
2883
+ if (Array.isArray(responseData) && !returnAll) {
2884
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2885
+ }
2886
+ }
2887
+ else if (operation === 'execDomainAnalyser') {
2888
+ const domain = this.getNodeParameter('domain', i);
2889
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecDomainAnalyser', {
2890
+ tenantFilter,
2891
+ Domain: domain,
2892
+ }, {});
2893
+ }
2894
+ else if (operation === 'listDomainHealth') {
2895
+ const returnAll = this.getNodeParameter('returnAll', i);
2896
+ const domain = this.getNodeParameter('domain', i);
2897
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListDomainHealth', {}, { Domain: domain });
2898
+ if (Array.isArray(responseData) && !returnAll) {
2899
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2900
+ }
2901
+ }
2902
+ else if (operation === 'listTenantDrift') {
2903
+ const returnAll = this.getNodeParameter('returnAll', i);
2904
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListTenantDrift', {}, { tenantFilter });
2905
+ if (Array.isArray(responseData) && !returnAll) {
2906
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2907
+ }
2908
+ }
2909
+ else if (operation === 'listTenantAlignment') {
2910
+ const returnAll = this.getNodeParameter('returnAll', i);
2911
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListTenantAlignment', {}, { tenantFilter });
2912
+ if (Array.isArray(responseData) && !returnAll) {
2913
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2914
+ }
2915
+ }
2916
+ else if (operation === 'execDriftClone') {
2917
+ const driftJson = this.getNodeParameter('driftJson', i);
2918
+ let driftData;
2919
+ try {
2920
+ driftData = JSON.parse(driftJson);
2921
+ }
2922
+ catch (e) {
2923
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Drift JSON must be valid JSON', { itemIndex: i });
2924
+ }
2925
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecDriftClone', {
2926
+ ...driftData,
2927
+ tenantFilter,
2928
+ }, {});
2929
+ }
2930
+ }
2931
+ // ==================== INTUNE ====================
2932
+ else if (resource === 'intune') {
2933
+ const tenantFilter = getTenantFilter();
2934
+ if (operation === 'listIntuneScripts') {
2935
+ const returnAll = this.getNodeParameter('returnAll', i);
2936
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListIntuneScript', {}, { tenantFilter });
2937
+ if (Array.isArray(responseData) && !returnAll) {
2938
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2939
+ }
2940
+ }
2941
+ else if (operation === 'editIntuneScript') {
2942
+ const scriptJson = this.getNodeParameter('intuneScriptJson', i);
2943
+ let scriptData;
2944
+ try {
2945
+ scriptData = JSON.parse(scriptJson);
2946
+ }
2947
+ catch (e) {
2948
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Script JSON must be valid JSON', { itemIndex: i });
2949
+ }
2950
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditIntuneScript', {
2951
+ ...scriptData,
2952
+ tenantFilter,
2953
+ }, {});
2954
+ }
2955
+ else if (operation === 'removeIntuneScript') {
2956
+ const id = this.getNodeParameter('intuneId', i);
2957
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/RemoveIntuneScript', {
2958
+ tenantFilter,
2959
+ ID: id,
2960
+ }, {});
2961
+ }
2962
+ else if (operation === 'listCompliancePolicies') {
2963
+ const returnAll = this.getNodeParameter('returnAll', i);
2964
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListCompliancePolicies', {}, { tenantFilter });
2965
+ if (Array.isArray(responseData) && !returnAll) {
2966
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2967
+ }
2968
+ }
2969
+ else if (operation === 'listAppProtectionPolicies') {
2970
+ const returnAll = this.getNodeParameter('returnAll', i);
2971
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListAppProtectionPolicies', {}, { tenantFilter });
2972
+ if (Array.isArray(responseData) && !returnAll) {
2973
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2974
+ }
2975
+ }
2976
+ else if (operation === 'listAssignmentFilters') {
2977
+ const returnAll = this.getNodeParameter('returnAll', i);
2978
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListAssignmentFilters', {}, { tenantFilter });
2979
+ if (Array.isArray(responseData) && !returnAll) {
2980
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
2981
+ }
2982
+ }
2983
+ else if (operation === 'addAssignmentFilter') {
2984
+ const filterJson = this.getNodeParameter('intuneFilterJson', i);
2985
+ let filterData;
2986
+ try {
2987
+ filterData = JSON.parse(filterJson);
2988
+ }
2989
+ catch (e) {
2990
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Filter JSON must be valid JSON', { itemIndex: i });
2991
+ }
2992
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddAssignmentFilter', {
2993
+ ...filterData,
2994
+ tenantFilter,
2995
+ }, {});
2996
+ }
2997
+ else if (operation === 'listIntuneReusableSettings') {
2998
+ const returnAll = this.getNodeParameter('returnAll', i);
2999
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListIntuneReusableSettings', {}, { tenantFilter });
3000
+ if (Array.isArray(responseData) && !returnAll) {
3001
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
3002
+ }
3003
+ }
3004
+ else if (operation === 'addIntuneReusableSetting') {
3005
+ const settingJson = this.getNodeParameter('intuneSettingJson', i);
3006
+ let settingData;
3007
+ try {
3008
+ settingData = JSON.parse(settingJson);
3009
+ }
3010
+ catch (e) {
3011
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Setting JSON must be valid JSON', { itemIndex: i });
3012
+ }
3013
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddIntuneReusableSetting', {
3014
+ ...settingData,
3015
+ tenantFilter,
3016
+ }, {});
3017
+ }
3018
+ else if (operation === 'removeIntuneReusableSetting') {
3019
+ const id = this.getNodeParameter('intuneId', i);
3020
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/RemoveIntuneReusableSetting', {
3021
+ tenantFilter,
3022
+ ID: id,
3023
+ }, {});
3024
+ }
3025
+ else if (operation === 'listIntuneTemplates') {
3026
+ const returnAll = this.getNodeParameter('returnAll', i);
3027
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListIntuneTemplates', {}, {});
3028
+ if (Array.isArray(responseData) && !returnAll) {
3029
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
3030
+ }
3031
+ }
3032
+ else if (operation === 'addWin32ScriptApp') {
3033
+ const appJson = this.getNodeParameter('intuneAppJson', i);
3034
+ let appData;
3035
+ try {
3036
+ appData = JSON.parse(appJson);
3037
+ }
3038
+ catch (e) {
3039
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'App JSON must be valid JSON', { itemIndex: i });
3040
+ }
3041
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddWin32ScriptApp', {
3042
+ ...appData,
3043
+ tenantFilter,
3044
+ }, {});
3045
+ }
3046
+ }
3047
+ // ==================== SHAREPOINT ====================
3048
+ else if (resource === 'sharepoint') {
3049
+ const tenantFilter = getTenantFilter();
3050
+ if (operation === 'deleteSharepointSite') {
3051
+ const siteUrl = this.getNodeParameter('siteUrl', i);
3052
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/DeleteSharepointSite', {
3053
+ tenantFilter,
3054
+ SiteUrl: siteUrl,
3055
+ }, {});
3056
+ }
3057
+ else if (operation === 'listSharepointQuota') {
3058
+ const returnAll = this.getNodeParameter('returnAll', i);
3059
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListSharepointQuota', {}, { tenantFilter });
3060
+ if (Array.isArray(responseData) && !returnAll) {
3061
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
3062
+ }
3063
+ }
3064
+ else if (operation === 'listSharepointSettings') {
3065
+ const returnAll = this.getNodeParameter('returnAll', i);
3066
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListSharepointSettings', {}, { tenantFilter });
3067
+ if (Array.isArray(responseData) && !returnAll) {
3068
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
3069
+ }
3070
+ }
3071
+ else if (operation === 'listSharepointAdminUrl') {
3072
+ const returnAll = this.getNodeParameter('returnAll', i);
3073
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListSharepointAdminUrl', {}, { tenantFilter });
3074
+ if (Array.isArray(responseData) && !returnAll) {
3075
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
3076
+ }
3077
+ }
3078
+ }
3079
+ // ==================== TESTING ====================
3080
+ else if (resource === 'testing') {
3081
+ const tenantFilter = getTenantFilter();
3082
+ if (operation === 'listTests') {
3083
+ const returnAll = this.getNodeParameter('returnAll', i);
3084
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListTests', {}, { tenantFilter });
3085
+ if (Array.isArray(responseData) && !returnAll) {
3086
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
3087
+ }
3088
+ }
3089
+ else if (operation === 'listAvailableTests') {
3090
+ const returnAll = this.getNodeParameter('returnAll', i);
3091
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListAvailableTests', {}, { tenantFilter });
3092
+ if (Array.isArray(responseData) && !returnAll) {
3093
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
3094
+ }
3095
+ }
3096
+ else if (operation === 'execTestRun') {
3097
+ const testJson = this.getNodeParameter('testJson', i);
3098
+ let testData;
3099
+ try {
3100
+ testData = JSON.parse(testJson);
3101
+ }
3102
+ catch (e) {
3103
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Test JSON must be valid JSON', { itemIndex: i });
3104
+ }
3105
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecTestRun', {
3106
+ ...testData,
3107
+ tenantFilter,
3108
+ }, {});
3109
+ }
3110
+ else if (operation === 'listTestReports') {
3111
+ const returnAll = this.getNodeParameter('returnAll', i);
3112
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'GET', '/api/ListTestReports', {}, { tenantFilter });
3113
+ if (Array.isArray(responseData) && !returnAll) {
3114
+ responseData = responseData.slice(0, this.getNodeParameter('limit', i));
3115
+ }
3116
+ }
3117
+ else if (operation === 'addTestReport') {
3118
+ const reportJson = this.getNodeParameter('reportJson', i);
3119
+ let reportData;
3120
+ try {
3121
+ reportData = JSON.parse(reportJson);
3122
+ }
3123
+ catch (e) {
3124
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Report JSON must be valid JSON', { itemIndex: i });
3125
+ }
3126
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddTestReport', {
3127
+ ...reportData,
3128
+ tenantFilter,
3129
+ }, {});
3130
+ }
3131
+ else if (operation === 'deleteTestReport') {
3132
+ const id = this.getNodeParameter('testReportId', i);
3133
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/DeleteTestReport', {
3134
+ tenantFilter,
3135
+ ID: id,
3136
+ }, {});
3137
+ }
3138
+ }
1638
3139
  // Handle response
1639
3140
  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
1640
3141
  returnData.push(...executionData);