mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Completed per-device notification support. #3190
This commit is contained in:
parent
2a363c0f60
commit
9720f0758e
4 changed files with 44 additions and 14 deletions
|
@ -2130,8 +2130,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||
// Handle any errors
|
||||
if (err != null) { if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'changemeshnotify', responseid: command.responseid, result: err })); } catch (ex) { } } break; }
|
||||
|
||||
// Change the notification (TODO: Add user group support, not sure how to do this here)
|
||||
// TODO (UserGroups)
|
||||
// Change the device group notification
|
||||
if (user.links[command.meshid]) {
|
||||
if (command.notify == 0) {
|
||||
delete user.links[command.meshid].notify;
|
||||
|
@ -2140,6 +2139,10 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||
}
|
||||
}
|
||||
|
||||
// Change user notification if needed, this is needed then a user has device rights thru a user group
|
||||
if ((command.notify == 0) && (user.notify != null) && (user.notify[command.meshid] != null)) { delete user.notify[command.meshid]; }
|
||||
if ((command.notify != 0) && (user.links[command.meshid] == null)) { if (user.notify == null) { user.notify = {} } user.notify[command.meshid] = command.notify; }
|
||||
|
||||
// Save the user
|
||||
parent.db.SetUser(user);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue