Skip to content

Commit

Permalink
Merge pull request #224 from skadefro/master
Browse files Browse the repository at this point in the history
close 1.4.11
  • Loading branch information
skadefro authored May 27, 2022
2 parents 25c0805 + 90eb94d commit f63150f
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 34 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ webpack.config.js
gulpfile.js
OpenFlow.code-workspace
CONTRIBUTING
Dockerfile
docker-compose.yml
docker-compose-toolbox.yml
docker-compose-traefik.yml
Expand Down
18 changes: 13 additions & 5 deletions OpenFlow/src/DatabaseConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1315,18 +1315,26 @@ export class DatabaseConnection extends events.EventEmitter {
user2.customerid = user.selectedcustomerid;
}
}
// if (NoderedUtil.IsNullEmpty(user2.customerid) && !NoderedUtil.IsNullEmpty(user.customerid)) {
// user2.customerid = user.customerid;
// }
if (NoderedUtil.IsNullEmpty(user2.customerid) && !NoderedUtil.IsNullEmpty(user.customerid)) {
user2.customerid = user.customerid;
}
}
if (this.WellknownIdsArray.indexOf(user2._id) > -1) {
delete user2.customerid;
}
if (!NoderedUtil.IsNullEmpty(user2.customerid)) {
customer = await this.getbyid<Customer>(user2.customerid, "users", jwt, true, span)
if (user2._type == "user") {
if (!user.HasRoleName("customer admins") && !user.HasRoleName("admins")) throw new Error("Access denied (not admin) to customer with id " + user2.customerid);
if (!user.HasRoleName("customer admins") && !user.HasRoleName("admins")) {
if (customer != null) {
var isadmin = user.roles.filter(x => x._id == customer.admins);
if (isadmin.length == 0) throw new Error("Access denied (not admin) to customer with id " + user2.customerid);
} else {
throw new Error("Access denied failed locating customerid " + user2.customerid);
}
}
}
customer = await this.getbyid<Customer>(user2.customerid, "users", jwt, true, span)

if (customer == null) throw new Error("Access denied to customer with id " + user2.customerid + " when updating " + user2._id);
} else if (user.HasRoleName("customer admins") && !NoderedUtil.IsNullEmpty(user.customerid)) {
// user2.customerid = user.customerid;
Expand Down
7 changes: 7 additions & 0 deletions OpenFlow/src/public/Controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ export class MenuCtrl {
hasrole(role: string) {
if (NoderedUtil.IsNullUndefinded(WebSocketClient.instance)) return false;
if (NoderedUtil.IsNullUndefinded(WebSocketClient.instance.user)) return false;
if (role == "customer admins" && !NoderedUtil.IsNullUndefinded(WebSocketClient.instance.user.customerid)) {
return true;
}
const hits = WebSocketClient.instance.user.roles.filter(member => member.name == role);
return (hits.length == 1)
}
Expand Down Expand Up @@ -2503,6 +2506,8 @@ export class UserCtrl extends entityCtrl<TokenUser> {
}
async submit(): Promise<void> {
try {
this.loading = true;
if (!this.$scope.$$phase) { this.$scope.$apply(); }
if (this.model._id) {
await NoderedUtil.UpdateOne({ collectionname: this.collection, item: this.model });
} else {
Expand All @@ -2528,8 +2533,10 @@ export class UserCtrl extends entityCtrl<TokenUser> {
}

}
this.loading = false;
this.$location.path("/Users");
} catch (error) {
this.loading = false;
this.errormessage = error.message ? error.message : error;
}
if (!this.$scope.$$phase) { this.$scope.$apply(); }
Expand Down
46 changes: 17 additions & 29 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,35 +216,23 @@ gulp.task("browserify", function () {
// 'gulp browserify',

gulp.task("compose", shell.task([
'echo "Build openiap/openflow"',
'docker build -t openiap/openflow:edge .',
'docker tag openiap/openflow:edge openiap/openflow:' + version,
'docker tag openiap/openflow:edge openiap/openflow:edge1.3',
'echo "Push openiap/openflow"',
'docker push openiap/openflow:edge',
'docker push openiap/openflow:' + version,

'echo "Build openiap/nodered"',
'cd OpenFlowNodeRED && docker build -t openiap/nodered:edge .',
'docker tag openiap/nodered:edge openiap/nodered:' + version,
'echo "Push openiap/nodered"',
'docker push openiap/nodered:edge',
'docker push openiap/nodered:' + version,

'echo "Build openiap/nodered-puppeteer"',
'cd OpenFlowNodeRED && docker build -t openiap/nodered-puppeteer:edge -f Dockerfilepuppeteer .',
'docker tag openiap/nodered-puppeteer:edge openiap/nodered-puppeteer:' + version,
'echo "Push openiap/nodered-puppeteer"',
'docker push openiap/nodered-puppeteer:edge',
'docker push openiap/nodered-puppeteer:' + version,

'echo "Build openiap/nodered-tagui"',
'cd OpenFlowNodeRED && docker build -t openiap/nodered-tagui:edge -f Dockerfiletagui .',
'docker tag openiap/nodered-tagui:edge openiap/nodered-tagui:' + version,
'echo "Push openiap/nodered-tagui"',
'docker push openiap/nodered-tagui:edge',
'docker push openiap/nodered-tagui:' + version,

// docker buildx create --name openiap --use
// docker buildx use default
// docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -t openiap/openflow:edge .
`echo "docker buildx build -t openiap/openflow:edge -t openiap/openflow:` + version + ` --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 --push ."`,
`echo "cd OpenFlowNodeRED && docker buildx build -t openiap/nodered:edge -t openiap/nodered:` + version + ` --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 --push ."'`,
`echo "cd OpenFlowNodeRED && docker buildx build -t openiap/nodered-puppeteer:edge -t openiap/nodered-puppeteer:` + version + ` --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 --push -f Dockerfilepuppeteer ."`,
`echo "cd OpenFlowNodeRED && docker buildx build -t openiap/nodered-tagui:edge -t openiap/nodered-tagui:` + version + ` --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 --push -f Dockerfiletagui ."`,
// 'echo "Build openiap/openflow"',
// 'docker buildx build -t openiap/openflow:edge -t openiap/openflow:' + version + ' --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 --push .',
// 'echo "Build openiap/nodered"',
// 'cd OpenFlowNodeRED && docker buildx build -t openiap/nodered:edge -t openiap/nodered:' + version + ' --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 --push .',

// 'echo "Build openiap/nodered"',
// 'cd OpenFlowNodeRED && docker buildx build -t openiap/nodered-puppeteer:edge -t openiap/nodered-puppeteer:' + version + ' --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 --push -f Dockerfilepuppeteer .',

// 'echo "Build openiap/nodered"',
// 'cd OpenFlowNodeRED && docker buildx build -t openiap/nodered-tagui:edge -t openiap/nodered-tagui:' + version + ' --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 --push -f Dockerfiletagui .',
]));

gulp.task("latest", shell.task([
Expand Down

0 comments on commit f63150f

Please sign in to comment.