Skip to content

Commit 2a2bc4f

Browse files
committed
improve error
1 parent 0cbb09c commit 2a2bc4f

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

OpenFlow/src/DatabaseConnection.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,8 +1097,7 @@ export class DatabaseConnection extends events.EventEmitter {
10971097
if (!user.HasRoleName("customer admins") && !user.HasRoleName("admins")) throw new Error("Access denied (not admin) to customer with id " + user2.customerid);
10981098
}
10991099
customer = await this.getbyid<Customer>(user2.customerid, "users", jwt, span)
1100-
if (customer == null) throw new Error("Access denied to customer with id " + user2.customerid);
1101-
// if (!user.HasRoleName(customer.name + " admins")) throw new Error("Access denied to customer with " + customer.name);
1100+
if (customer == null) throw new Error("Access denied to customer with id " + user2.customerid + " when updating " + user2._id);
11021101
} else if (user.HasRoleName("customer admins") && !NoderedUtil.IsNullEmpty(user.customerid)) {
11031102
// user2.customerid = user.customerid;
11041103
if (NoderedUtil.IsNullEmpty(user2.selectedcustomerid)) {
@@ -1547,7 +1546,7 @@ export class DatabaseConnection extends events.EventEmitter {
15471546
// User can update, just not created ?
15481547
// if (!user.HasRoleName("customer admins") && !user.HasRoleName("admins")) throw new Error("Access denied (not admin) to customer with id " + user2.customerid);
15491548
customer = await this.getbyid<Customer>(user2.customerid, "users", q.jwt, span)
1550-
if (customer == null) throw new Error("Access denied to customer with id " + user2.customerid);
1549+
if (customer == null) throw new Error("Access denied to customer with id " + user2.customerid + " when updating " + user2._id);
15511550
} else if (user.HasRoleName("customer admins") && !NoderedUtil.IsNullEmpty(user.customerid)) {
15521551
customer = null;
15531552
if (!NoderedUtil.IsNullEmpty(user.selectedcustomerid)) {
@@ -1560,7 +1559,7 @@ export class DatabaseConnection extends events.EventEmitter {
15601559
customer = await this.getbyid<Customer>(user2.customerid, "users", q.jwt, span);
15611560
if (customer != null) user2.customerid = user.customerid;
15621561
if (customer == null) {
1563-
throw new Error("Access denied to customer with id " + user2.customerid);
1562+
throw new Error("Access denied to customer with id " + user2.customerid + " when updating " + user2._id);
15641563
}
15651564
}
15661565
}

0 commit comments

Comments
 (0)