mirror of
				https://github.com/Ylianst/MeshCentral.git
				synced 2025-03-09 15:40:18 +00:00 
			
		
		
		
	Fixed install dependencies install, Device group incorrectly showing up on admin account.
This commit is contained in:
		
							parent
							
								
									870ef4c279
								
							
						
					
					
						commit
						3eef0f3e71
					
				
					 3 changed files with 23 additions and 7 deletions
				
			
		| 
						 | 
					@ -2254,7 +2254,7 @@ function InstallModule(modulename, func, tag1, tag2) {
 | 
				
			||||||
    // Get the working directory
 | 
					    // Get the working directory
 | 
				
			||||||
    if ((__dirname.endsWith('/node_modules/meshcentral')) || (__dirname.endsWith('\\node_modules\\meshcentral')) || (__dirname.endsWith('/node_modules/meshcentral/')) || (__dirname.endsWith('\\node_modules\\meshcentral\\'))) { parentpath = require('path').join(__dirname, '../..'); }
 | 
					    if ((__dirname.endsWith('/node_modules/meshcentral')) || (__dirname.endsWith('\\node_modules\\meshcentral')) || (__dirname.endsWith('/node_modules/meshcentral/')) || (__dirname.endsWith('\\node_modules\\meshcentral\\'))) { parentpath = require('path').join(__dirname, '../..'); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    child_process.exec(`npm install --no-save --no-optional ${modulename}`, { maxBuffer: 512000, timeout: 120000, cwd: parentpath }, function (error, stdout, stderr) {
 | 
					    child_process.exec(`npm install --no-optional ${modulename}`, { maxBuffer: 512000, timeout: 120000, cwd: parentpath }, function (error, stdout, stderr) {
 | 
				
			||||||
        if ((error != null) && (error != '')) {
 | 
					        if ((error != null) && (error != '')) {
 | 
				
			||||||
            console.log('ERROR: Unable to install required module "' + modulename + '". MeshCentral may not have access to npm, or npm may not have suffisent rights to load the new module. Try "npm install ' + modulename + '" to manualy install this module.\r\n');
 | 
					            console.log('ERROR: Unable to install required module "' + modulename + '". MeshCentral may not have access to npm, or npm may not have suffisent rights to load the new module. Try "npm install ' + modulename + '" to manualy install this module.\r\n');
 | 
				
			||||||
            process.exit();
 | 
					            process.exit();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -945,9 +945,17 @@
 | 
				
			||||||
                        case 'meshchange': {
 | 
					                        case 'meshchange': {
 | 
				
			||||||
                            // Update mesh information
 | 
					                            // Update mesh information
 | 
				
			||||||
                            if (meshes[message.event.meshid] == null) {
 | 
					                            if (meshes[message.event.meshid] == null) {
 | 
				
			||||||
 | 
					                                // Check if we have any access to this device group
 | 
				
			||||||
 | 
					                                var add = false;
 | 
				
			||||||
 | 
					                                if (message.event.links[userinfo._id] != null) { add = true; }
 | 
				
			||||||
 | 
					                                if (userinfo.links[message.event.meshid] != null) { add = true; }
 | 
				
			||||||
 | 
					                                for (var i in userinfo.links) { if ((i.startsWith('ugrp/')) && (message.event.links[i] != null)) { add = true; } }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                // This is a new mesh for us
 | 
					                                // This is a new mesh for us
 | 
				
			||||||
                                meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links };
 | 
					                                if (add) {
 | 
				
			||||||
                                meshserver.send({ action: 'nodes' }); // Request a refresh of all nodes (TODO: We could optimize this to only request nodes for the new mesh).
 | 
					                                    meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links };
 | 
				
			||||||
 | 
					                                    meshserver.send({ action: 'nodes' }); // Request a refresh of all nodes (TODO: We could optimize this to only request nodes for the new mesh).
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
                            } else {
 | 
					                            } else {
 | 
				
			||||||
                                // This is an existing mesh
 | 
					                                // This is an existing mesh
 | 
				
			||||||
                                if (meshes[message.event.meshid].name != message.event.name) {
 | 
					                                if (meshes[message.event.meshid].name != message.event.name) {
 | 
				
			||||||
| 
						 | 
					@ -3477,7 +3485,7 @@
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return rights;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Return the user rights for a given node
 | 
					        // Return the user rights for a given node
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2314,9 +2314,17 @@
 | 
				
			||||||
                        case 'meshchange': {
 | 
					                        case 'meshchange': {
 | 
				
			||||||
                            // Update mesh information
 | 
					                            // Update mesh information
 | 
				
			||||||
                            if (meshes[message.event.meshid] == null) {
 | 
					                            if (meshes[message.event.meshid] == null) {
 | 
				
			||||||
 | 
					                                // Check if we have any access to this device group
 | 
				
			||||||
 | 
					                                var add = false;
 | 
				
			||||||
 | 
					                                if (message.event.links[userinfo._id] != null) { add = true; }
 | 
				
			||||||
 | 
					                                if (userinfo.links[message.event.meshid] != null) { add = true; }
 | 
				
			||||||
 | 
					                                for (var i in userinfo.links) { if ((i.startsWith('ugrp/')) && (message.event.links[i] != null)) { add = true; } }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                // This is a new mesh for us
 | 
					                                // This is a new mesh for us
 | 
				
			||||||
                                meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links };
 | 
					                                if (add) {
 | 
				
			||||||
                                meshserver.send({ action: 'nodes' }); // Request a refresh of all nodes (TODO: We could optimize this to only request nodes for the new mesh).
 | 
					                                    meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links };
 | 
				
			||||||
 | 
					                                    meshserver.send({ action: 'nodes' }); // Request a refresh of all nodes (TODO: We could optimize this to only request nodes for the new mesh).
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
                            } else {
 | 
					                            } else {
 | 
				
			||||||
                                // This is an existing mesh
 | 
					                                // This is an existing mesh
 | 
				
			||||||
                                if (message.event.name != null) {
 | 
					                                if (message.event.name != null) {
 | 
				
			||||||
| 
						 | 
					@ -10720,7 +10728,7 @@
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return rights;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Return the user rights for a given node
 | 
					        // Return the user rights for a given node
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue