mirror of
				https://github.com/Ylianst/MeshCentral.git
				synced 2025-03-09 15:40:18 +00:00 
			
		
		
		
	Simplify removeuserfromusergroup - remove unneeded condition/variable
This commit is contained in:
		
							parent
							
								
									92c53d9854
								
							
						
					
					
						commit
						d1523c3bbf
					
				
					 1 changed files with 3 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -6015,9 +6015,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
 | 
			
		|||
 | 
			
		||||
        var chguser = parent.users[command.userid];
 | 
			
		||||
        if (chguser != null) {
 | 
			
		||||
            var change = false;
 | 
			
		||||
            if ((chguser.links != null) && (chguser.links[command.ugrpid] != null)) {
 | 
			
		||||
                change = true;
 | 
			
		||||
                delete chguser.links[command.ugrpid];
 | 
			
		||||
 | 
			
		||||
                // Notify user change
 | 
			
		||||
| 
						 | 
				
			
			@ -6035,19 +6033,16 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
 | 
			
		|||
            if (group != null) {
 | 
			
		||||
                // Remove the user from the group
 | 
			
		||||
                if ((group.links != null) && (group.links[command.userid] != null)) {
 | 
			
		||||
                    change = true;
 | 
			
		||||
                    delete group.links[command.userid];
 | 
			
		||||
                    db.Set(group);
 | 
			
		||||
 | 
			
		||||
                    // Notify user group change
 | 
			
		||||
                    if (change) {
 | 
			
		||||
                    var event = { etype: 'ugrp', userid: user._id, username: user.name, ugrpid: group._id, name: group.name, desc: group.desc, action: 'usergroupchange', links: group.links, msgid: 72, msgArgs: [chguser.name, group.name], msg: 'Removed user ' + chguser.name + ' from user group ' + group.name, domain: removeUserDomain.id };
 | 
			
		||||
                    if (db.changeStream) { event.noact = 1; } // If DB change stream is active, don't use this event to change the user group. Another event will come.
 | 
			
		||||
                    parent.parent.DispatchEvent(['*', group._id, user._id, chguser._id], obj, event);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'removeuserfromusergroup', responseid: command.responseid, result: 'ok' })); } catch (ex) { } }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue