@5minds/node-red-contrib-processcube 1.7.6-feature-e920aa-m6ujqgzl → 1.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/externaltask-input.html +1 -1
- package/package.json +1 -2
- package/process-terminate.html +1 -1
- package/check-authorization.html +0 -145
- package/check-authorization.js +0 -27
package/externaltask-input.html
CHANGED
@@ -72,7 +72,7 @@ the connected ProcessCube Engine for processing.
|
|
72
72
|
## Configs
|
73
73
|
|
74
74
|
: name (string) : The name of the node
|
75
|
-
: engine (
|
75
|
+
: engine (string) : The ProcessCube Engine to connect to
|
76
76
|
: topic (string) : The topic of the external task
|
77
77
|
: workerConfig (object) : The configuration for the worker
|
78
78
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@5minds/node-red-contrib-processcube",
|
3
|
-
"version": "1.7.6
|
3
|
+
"version": "1.7.6",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "Node-RED nodes for ProcessCube",
|
6
6
|
"scripts": {
|
@@ -35,7 +35,6 @@
|
|
35
35
|
"node-red": {
|
36
36
|
"version": ">=3.1.9",
|
37
37
|
"nodes": {
|
38
|
-
"checkAuthorization": "check-authorization.js",
|
39
38
|
"EndEventFinishedListener": "endevent-finished-listener.js",
|
40
39
|
"externaltaskInput": "externaltask-input.js",
|
41
40
|
"externaltaskOutput": "externaltask-output.js",
|
package/process-terminate.html
CHANGED
package/check-authorization.html
DELETED
@@ -1,145 +0,0 @@
|
|
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 (engine-node): 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© Developer Network](https://processcube.io) - All documentation for the ProcessCube© platform
|
144
|
-
- [ProcessCube© LowCode Integration](https://processcube.io/docs/node-red) - LowCode integration in ProcessCube©
|
145
|
-
</script>
|
package/check-authorization.js
DELETED
@@ -1,27 +0,0 @@
|
|
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
|
-
};
|