mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-22 22:17:31 +03:00
Added support device email notifications when user groups are used.
This commit is contained in:
parent
3815606eb7
commit
064540d865
@ -2094,10 +2094,19 @@ function CreateMeshCentralServer(config, args) {
|
||||
const mesh = obj.webserver.meshes[meshid];
|
||||
if ((mesh == null) || (mesh.links == null)) return;
|
||||
|
||||
// Check if any user needs email notification
|
||||
// TODO: Add user group support.
|
||||
// Get the list of users that have visibility to this device
|
||||
// This includes users that are part of user groups
|
||||
var users = [];
|
||||
for (var i in mesh.links) {
|
||||
if (i.startsWith('user/')) {
|
||||
if (i.startsWith('user/') && (users.indexOf(i) < 0)) { users.push(i); }
|
||||
if (i.startsWith('ugrp/')) {
|
||||
var usergrp = obj.webserver.userGroups[i];
|
||||
if (usergrp.links != null) { for (var j in usergrp.links) { if (j.startsWith('user/') && (users.indexOf(j) < 0)) { users.push(j); } } }
|
||||
}
|
||||
}
|
||||
|
||||
// Check if any user needs email notification
|
||||
for (var i in users) {
|
||||
const user = obj.webserver.users[i];
|
||||
if ((user != null) && (user.email != null) && (user.emailVerified == true)) {
|
||||
var notify = 0;
|
||||
@ -2131,7 +2140,6 @@ function CreateMeshCentralServer(config, args) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set the connectivity state of a node and setup the server so that messages can be routed correctly.
|
||||
// meshId: mesh identifier of format mesh/domain/meshidhex
|
||||
|
Loading…
Reference in New Issue
Block a user