Skip to content

Commit f74fc1c

Browse files
committed
add administrator role work around
1 parent b0b7e0f commit f74fc1c

4 files changed

Lines changed: 19 additions & 6 deletions

File tree

OpenFlow/src/DatabaseConnection.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,11 @@ export class DatabaseConnection {
880880
if ((item._type === "user" || item._type === "role") &&
881881
(this.WellknownNamesArray.indexOf(item.name) > -1 || this.WellknownNamesArray.indexOf((item as any).username) > -1)) {
882882
if (this.WellknownIdsArray.indexOf(item._id) == -1) {
883-
throw new Error("Access denied");
883+
if (item._type == "role" && item.name == "administrator") {
884+
// temp, allow this
885+
} else {
886+
throw new Error("Access denied");
887+
}
884888
}
885889
}
886890
}
@@ -1113,7 +1117,11 @@ export class DatabaseConnection {
11131117
if ((item._type === "user" || item._type === "role") &&
11141118
(this.WellknownNamesArray.indexOf(item.name) > -1 || this.WellknownNamesArray.indexOf((item as any).username) > -1)) {
11151119
if (this.WellknownIdsArray.indexOf(item._id) == -1) {
1116-
throw new Error("Access denied");
1120+
if (item._type == "role" && item.name == "administrator") {
1121+
// temp, allow this
1122+
} else {
1123+
throw new Error("Access denied");
1124+
}
11171125
}
11181126
}
11191127
}
@@ -1313,7 +1321,12 @@ export class DatabaseConnection {
13131321
if ((q.item._type === "user" || q.item._type === "role") &&
13141322
(this.WellknownNamesArray.indexOf(q.item.name) > -1 || this.WellknownNamesArray.indexOf((q.item as any).username) > -1)) {
13151323
if (this.WellknownIdsArray.indexOf(q.item._id) == -1) {
1316-
throw new Error("Access denied");
1324+
if (q.item._type == "role" && q.item.name == "administrator") {
1325+
// temp, allow this
1326+
} else {
1327+
throw new Error("Access denied");
1328+
}
1329+
13171330
}
13181331
}
13191332
}

OpenFlowNodeRED/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openiap/nodered",
3-
"version": "1.3.55",
3+
"version": "1.3.56",
44
"description": "Simple wrapper around NodeRed, RabbitMQ and MongoDB to support a more scaleable NodeRed implementation.\r Also the \"backend\" for [OpenRPA](https://github.com/skadefro/OpenRPA)",
55
"main": "index.js",
66
"scripts": {

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.55
1+
1.3.56

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openiap/openflow",
3-
"version": "1.3.55",
3+
"version": "1.3.56",
44
"description": "Simple wrapper around NodeRed, RabbitMQ and MongoDB to support a more scaleable NodeRed implementation.\r Also the \"backend\" for [OpenRPA](https://github.com/skadefro/OpenRPA)",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)