fix obj.user._id undefined for rdp/ssh #6127
Signed-off-by: si458 <simonsmith5521@gmail.com>
si458 committed
Jun 11, 2024 at 10:05 UTC
b08f3827f572f1ac37f01c37515ec212816b3b5d
1 file changed
+5
-5
meshuser.js
+5
-5
@@ -778,10 +778,10 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
778
779
// Remove SSH credentials if present
780
if (docs[i].ssh != null) {
781
- if ((docs[i].ssh[obj.user._id] != null) && (docs[i].ssh[obj.user._id].u)) {
782
- if (docs[i].ssh.k && docs[i].ssh[obj.user._id].kp) { docs[i].ssh = 2; } // Username, key and password
783
- else if (docs[i].ssh[obj.user._id].k) { docs[i].ssh = 3; } // Username and key. No password.
784
- else if (docs[i].ssh[obj.user._id].p) { docs[i].ssh = 1; } // Username and password
781
+ if ((docs[i].ssh[user._id] != null) && (docs[i].ssh[user._id].u)) {
782
+ if (docs[i].ssh.k && docs[i].ssh[user._id].kp) { docs[i].ssh = 2; } // Username, key and password
783
+ else if (docs[i].ssh[user._id].k) { docs[i].ssh = 3; } // Username and key. No password.
784
+ else if (docs[i].ssh[user._id].p) { docs[i].ssh = 1; } // Username and password
785
else { delete docs[i].ssh; }
786
} else {
787
delete docs[i].ssh;
@@ -789,7 +789,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
789
}
790
791
// Remove RDP credentials if present, only set to 1 if our userid has RDP credentials
792
- if ((docs[i].rdp != null) && (docs[i].rdp[obj.user._id] != null)) { docs[i].rdp = 1; } else { delete docs[i].rdp; }
792
+ if ((docs[i].rdp != null) && (docs[i].rdp[user._id] != null)) { docs[i].rdp = 1; } else { delete docs[i].rdp; }
793
794
// Remove Intel AMT credential if present
795
if (docs[i].intelamt != null) {