@5minds/node-red-contrib-processcube 1.7.6-feature-09f2e7-m6t8tjdp → 1.7.6-feature-1eae0e-m6ufq2sz

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.
@@ -0,0 +1,145 @@
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType('check-authorization', {
3
+ category: 'ProcessCube',
4
+ color: '#02AFD6',
5
+ defaults: {
6
+ name: { value: '' },
7
+ engine: { value: '', type: 'processcube-engine-config' },
8
+ options: {
9
+ value: [{ claim: '' }],
10
+ },
11
+ },
12
+ inputs: 1,
13
+ outputs: 2,
14
+ outputLabels: function (index) {
15
+ if (index === 0) {
16
+ return 'Authorized'
17
+ } else {
18
+ return 'Unauthorized'
19
+ }
20
+ },
21
+ icon: 'font-awesome/fa-sign-in',
22
+ label: function () {
23
+ return this.name || 'check-authorization';
24
+ },
25
+ oneditprepare: function () {
26
+ $('#node-input-size').elementSizer({
27
+ width: '#node-input-width',
28
+ height: '#node-input-height',
29
+ group: '#node-input-group',
30
+ });
31
+
32
+ function generateOption(i, option) {
33
+ const container = $('<li/>', {
34
+ style: 'background: var(--red-ui-secondary-background, #fff); margin:0; padding:8px 0px 0px;',
35
+ });
36
+
37
+ const row = $('<div/>').appendTo(container);
38
+
39
+ $('<input/>', {
40
+ class: 'node-input-option-claim',
41
+ type: 'text',
42
+ style: 'margin-left:7px; width:calc(85%);',
43
+ placeholder: 'Claim',
44
+ value: option.claim,
45
+ })
46
+ .appendTo(row)
47
+ .typedInput({
48
+ type: 'str',
49
+ types: ['str'],
50
+ });
51
+
52
+ // Create delete button for the option
53
+ const finalSpan = $('<span/>', {
54
+ style: 'float:right; margin-right:8px;',
55
+ }).appendTo(row);
56
+ const deleteButton = $('<a/>', {
57
+ href: '#',
58
+ class: 'editor-button editor-button-small',
59
+ style: 'margin-top:7px; margin-left:5px;',
60
+ }).appendTo(finalSpan);
61
+ $('<i/>', { class: 'fa fa-remove' }).appendTo(deleteButton);
62
+
63
+ deleteButton.click(function () {
64
+ container.css({
65
+ background: 'var(--red-ui-secondary-background-inactive, #fee)',
66
+ });
67
+ container.fadeOut(300, function () {
68
+ $(this).remove();
69
+ });
70
+ });
71
+
72
+ $('#node-input-option-container').append(container);
73
+ }
74
+
75
+ $('#node-input-add-option').click(function () {
76
+ generateOption($('#node-input-option-container').children().length + 1, {});
77
+ $('#node-input-option-container-div').scrollTop(
78
+ $('#node-input-option-container-div').get(0).scrollHeight
79
+ );
80
+ });
81
+
82
+ for (let i = 0; i < this.options.length; i++) {
83
+ const option = this.options[i];
84
+ generateOption(i + 1, option);
85
+ }
86
+
87
+ $('#node-input-option-container').sortable({
88
+ axis: 'y',
89
+ handle: '.node-input-option-handle',
90
+ cursor: 'move',
91
+ });
92
+ },
93
+ oneditsave: function () {
94
+ const options = $('#node-input-option-container').children();
95
+ const node = this;
96
+ node.options = [];
97
+ options.each(function (i) {
98
+ const option = $(this);
99
+ const o = {
100
+ claim: option.find('.node-input-option-claim').val(),
101
+ };
102
+
103
+ node.options.push(o);
104
+ });
105
+ },
106
+ });
107
+ </script>
108
+
109
+ <script type="text/html" data-template-name="check-authorization">
110
+ <div class="form-row">
111
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
112
+ <input type="text" id="node-input-name" placeholder="Name" />
113
+ </div>
114
+
115
+ <div class="form-row">
116
+ <label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
117
+ <input type="text" id="node-input-engine" placeholder="Engine-URL" />
118
+ </div>
119
+
120
+ <div class="form-row form-row-flex node-input-option-container-row" style="margin-bottom: 0px;width: 100%">
121
+ <label for="node-input-width" style="vertical-align:top"><i class="fa fa-list-alt"></i> Claims</label>
122
+ <div id="node-input-option-container-div" style="box-sizing:border-box; border-radius:5px; height:257px; padding:5px; border:1px solid var(--red-ui-form-input-border-color, #ccc); overflow-y:scroll; display:inline-block; width: 70%;">
123
+ <ol id="node-input-option-container" style="list-style-type:none; margin:0;"></ol>
124
+ </div>
125
+ </div>
126
+ <!-- Add Claim Button -->
127
+ <div class="form-row">
128
+ <a href="#" class="editor-button editor-button-small" id="node-input-add-option" style="margin-top:4px; margin-left:103px;"><i class="fa fa-plus"></i> <span>action</span></a>
129
+ </div>
130
+ </script>
131
+
132
+ <script type="text/markdown" data-help-name="check-authorization">
133
+ A Node that checks if a user has the specified claims
134
+
135
+ ## Configs
136
+
137
+ : name (string): name of the node
138
+ : engine (string): the engine to connect to
139
+ : claims (list of strings): the claims the user needs to be authorized
140
+
141
+ ### References
142
+
143
+ - [The ProcessCube&copy; Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
144
+ - [ProcessCube&copy; LowCode Integration](https://processcube.io/docs/node-red) - LowCode integration in ProcessCube&copy;
145
+ </script>
@@ -0,0 +1,27 @@
1
+ module.exports = function (RED) {
2
+ function CheckAuthorization(config) {
3
+ RED.nodes.createNode(this, config);
4
+ const node = this;
5
+
6
+ const claimsToCheck = (config.options || []).map((option) => option.claim);
7
+
8
+ node.on('input', function (msg) {
9
+ if (!msg._client || !msg._client.user || typeof msg._client.user.claims !== "object") {
10
+ node.error("Invalid client claims in the input message", msg);
11
+ return;
12
+ }
13
+
14
+ const userClaims = msg._client.user.claims;
15
+
16
+ const isAuthorized = claimsToCheck.every((claim) => claim in userClaims);
17
+
18
+ if (isAuthorized) {
19
+ node.send([msg, undefined]);
20
+ } else {
21
+ node.send([undefined, msg]);
22
+ }
23
+ });
24
+ }
25
+
26
+ RED.nodes.registerType('check-authorization', CheckAuthorization);
27
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.7.6-feature-09f2e7-m6t8tjdp",
3
+ "version": "1.7.6-feature-1eae0e-m6ufq2sz",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
@@ -35,6 +35,7 @@
35
35
  "node-red": {
36
36
  "version": ">=3.1.9",
37
37
  "nodes": {
38
+ "checkAuthorization": "check-authorization.js",
38
39
  "EndEventFinishedListener": "endevent-finished-listener.js",
39
40
  "externaltaskInput": "externaltask-input.js",
40
41
  "externaltaskOutput": "externaltask-output.js",
@@ -44,10 +44,19 @@
44
44
  <label for="node-input-query"><i class="fa fa-tag"></i> Query</label>
45
45
  <input type="text" id="node-input-query" />
46
46
  </div>
47
-
48
- <div class="form-row" style="margin-bottom: 3px;">
49
- <input type="checkbox" checked id="node-input-models_only" style="display: inline-block; width: auto; vertical-align: top; margin-left: 30px; margin-right: 5px;">
50
- <label style="width:auto" for="node-input-models_only">Only send models as result</label>
47
+ <div class="form-row" style="display:flex; margin-bottom: 3px;">
48
+ <label for="node-input-models_only" style="vertical-align:top"
49
+ ><i class="fa fa-list-alt"></i> Models Only</label
50
+ >
51
+ <div>
52
+ <input
53
+ type="checkbox"
54
+ checked
55
+ id="node-input-models_only"
56
+ style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;"
57
+ />
58
+ <label style="width:auto" for="node-input-models_only">Only send models as result.</label>
59
+ </div>
51
60
  </div>
52
61
  </script>
53
62
 
@@ -72,15 +81,122 @@ Only models can be queried by setting the `models_only` flag.
72
81
 
73
82
  **Summary**:
74
83
 
75
- **Description**: Filter result for &#39;ProcessDefinitions Query&#39;
84
+ **Description**: Filter result for &#39;ProcessInstance Query&#39;
76
85
 
77
86
  #### Parameters:
78
87
  - Name: `offset` Required: `false`
79
88
  - Type: number
80
- - Description: The index of the first ProcessDefinition to include.
89
+ - Description: The index of the first ProcessInstance to include in the result set.
81
90
  - Name: `limit` Required: `false`
82
91
  - Type: number
83
- - Description: The maximum number of ProcessDefinitions to include.
92
+ - Description: The maximum number of ProcessInstances to return.
93
+ - Name: `correlationId` Required: `false`
94
+ - Type: Array&lt;string&gt; | string | SearchQuery
95
+ - string: myCorrelationId
96
+ - Array&lt;string&gt;: myCorrelationId1,myCorrelationId2
97
+ - object:
98
+ - Description: Filter by the CorrelationId of the ProcessInstances.
99
+ - Name: `processInstanceId` Required: ``
100
+ - Type: Array&lt;string&gt; | string | SearchQuery
101
+ - string: myProcessInstance_12345678
102
+ - Array&lt;string&gt;: myProcessInstance_12345678,myProcessInstance_87654321
103
+ - object:
104
+ - Description: Filter by the ID of the ProcessInstances.
105
+ - Name: `processDefinitionId` Required: ``
106
+ - Type: Array&lt;string&gt; | string | SearchQuery
107
+ - string: myProcess_12345678
108
+ - Array&lt;string&gt;: myProcess_12345678,myProcess_87654321
109
+ - object:
110
+ - Description: Filter by the ID of the ProcessDefinition that the ProcessInstances belong to.
111
+ - Name: `processModelId` Required: ``
112
+ - Type: Array&lt;string&gt; | string | SearchQuery
113
+ - string: myProcessModel_12345678
114
+ - Array&lt;string&gt;: myProcessModel_12345678,myProcessModel_87654321
115
+ - object:
116
+ - Description: Filter by the ID of the ProcessModel that the ProcessInstances belong to.
117
+ - Name: `processModelName` Required: ``
118
+ - Type: Array&lt;string&gt; | string | SearchQuery
119
+ - string: My Process Model
120
+ - Array&lt;string&gt;: My Process Model,My Other Process Model
121
+ - object:
122
+ - Description: Filter by the name of the ProcessModel that the ProcessInstances belong to.
123
+ - Name: `processModelHash` Required: ``
124
+ - Type: Array&lt;string&gt; | string | SearchQuery
125
+ - string: 12345678
126
+ - Array&lt;string&gt;: 12345678,87654321
127
+ - object:
128
+ - Description: Filter by the hash of the ProcessModel that the ProcessInstances belong to.
129
+ - Name: `ownerId` Required: ``
130
+ - Type: Array&lt;string&gt; | string | SearchQuery
131
+ - string: 12345678
132
+ - Array&lt;string&gt;: 12345678,87654321
133
+ - object:
134
+ - Description: Filter by the ID of the User that owns the ProcessInstances.
135
+ - Name: `state` Required: ``
136
+ - Type: Array&lt;string&gt; | string | SearchQuery
137
+ - string: running
138
+ - Array&lt;string&gt;: running,finished
139
+ - object:
140
+ - Description: Filter by the state of the ProcessInstances.
141
+ - Name: `parentProcessInstanceId` Required: ``
142
+ - Type: Array&lt;string&gt; | string | SearchQuery
143
+ - string: myParentProcessInstance_12345678
144
+ - Array&lt;string&gt;: myParentProcessInstance_12345678,myParentProcessInstance_87654321
145
+ - object:
146
+ - Description: Filter by the ID of the parent ProcessInstance.
147
+ - Name: `embeddedProcessModelId` Required: ``
148
+ - Type: Array&lt;string&gt; | string | SearchQuery
149
+ - string: myModel1
150
+ - Array&lt;string&gt;: myModel1,myModel2
151
+ - object:
152
+ - Description: Filter by the ID of the embedded process model.
153
+ - Name: `terminatedByUserId` Required: ``
154
+ - Type: Array&lt;string&gt; | string | SearchQuery
155
+ - string: 12345678
156
+ - Array&lt;string&gt;: 12345678,87654321
157
+ - object:
158
+ - Description: Filter by the ID of the User that terminated the ProcessInstances.
159
+ - Name: `createdBefore` Required: ``
160
+ - Type: string
161
+ - Description: The maximum created date of the ProcessInstances to include in the results.
162
+ - Name: `createdAt` Required: ``
163
+ - Type: Array&lt;string&gt; | string
164
+ - string: 2021-01-01T00:00:00.000Z
165
+ - array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
166
+ - Description: The minimum created date of the ProcessInstances to include in the results.
167
+ - Name: `createdAfter` Required: ``
168
+ - Type: string
169
+ - Description: The minimum created date of the ProcessInstances to include in the results.
170
+ - Name: `updatedBefore` Required: ``
171
+ - Type: string
172
+ - Description: The maximum updated date of the ProcessInstances to include in the results.
173
+ - Name: `updatedAt` Required: ``
174
+ - Type: Array&lt;string&gt; | string
175
+ - string: 2021-01-01T00:00:00.000Z
176
+ - array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
177
+ - Description: The exact updated date of the ProcessInstances to include in the results.
178
+ - Name: `updatedAfter` Required: ``
179
+ - Type: string
180
+ - Description: The minimum updated date of the ProcessInstances to include in the results.
181
+ - Name: `finishedBefore` Required: ``
182
+ - Type: string
183
+ - Description: The maximum finished date of the ProcessInstances to include in the results.
184
+ - Name: `finishedAt` Required: ``
185
+ - Type: Array&lt;string&gt; | string
186
+ - string: 2021-01-01T00:00:00.000Z
187
+ - array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
188
+ - Description: The exact finished date of the ProcessInstances to include in the results.
189
+ - Name: `finishedAfter` Required: ``
190
+ - Type: string
191
+ - Description: The minimum finished date of the ProcessInstances to include in the results.
192
+ - Name: `triggeredByFlowNodeInstance` Required: ``
193
+ - Type: Array&lt;string&gt; | string | SearchQuery
194
+ - string: myFlowNodeInstance_12345678
195
+ - array: myFlowNodeInstance_12345678,myFlowNodeInstance_87654321
196
+ - object:
197
+ - Description: Filter by the ID of the FlowNodeInstance that triggered the ProcessInstance.
198
+
199
+
84
200
  ### References
85
201
 
86
202
  - [The ProcessCube&copy; Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
@@ -45,9 +45,12 @@
45
45
  <label for="node-input-query"><i class="fa fa-tag"></i> Query</label>
46
46
  <input type="text" id="node-input-query">
47
47
  </div>
48
- <div class="form-row" style="margin-bottom: 3px;">
49
- <input type="checkbox" checked id="node-input-only_for_new" style="display: inline-block; width: auto; vertical-align: top; margin-left: 30px; margin-right: 5px;">
50
- <label style="width:auto" for="node-input-multisend">Wait only for for new usertasks</label>
48
+ <div class="form-row" style="display:flex; margin-bottom: 3px;">
49
+ <label for="node-input-only_for_new" style="vertical-align:top"><i class="fa fa-list-alt"></i> Only for new</label>
50
+ <div>
51
+ <input type="checkbox" checked id="node-input-only_for_new" style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;">
52
+ <label style="width:auto" for="node-input-multisend">Trigger only for new user task or *checked* also for old ones?</label>
53
+ </div>
51
54
  </div>
52
55
  </script>
53
56