mirror of
				https://github.com/itsdave-de/msp_remoteadmin.git
				synced 2025-10-30 23:51:02 -03:00 
			
		
		
		
	insert new fields
This commit is contained in:
		
							parent
							
								
									81147fd9a6
								
							
						
					
					
						commit
						bba145e9f3
					
				| @ -50,7 +50,7 @@ def log_end_session(session_id, end_time): | |||||||
|         frappe.logger().error(f"Session {session_id} not found in Frappe") |         frappe.logger().error(f"Session {session_id} not found in Frappe") | ||||||
|         return False |         return False | ||||||
| 
 | 
 | ||||||
| def log_guacamole_session(url, protocol, host, user): | def log_guacamole_session(session_data): | ||||||
|     # Wait for guacamole to create the session |     # Wait for guacamole to create the session | ||||||
|     time.sleep(1.8) |     time.sleep(1.8) | ||||||
|     active_sessions = frappe.get_all( |     active_sessions = frappe.get_all( | ||||||
| @ -66,9 +66,11 @@ def log_guacamole_session(url, protocol, host, user): | |||||||
|     for session in active_sessions: |     for session in active_sessions: | ||||||
|         try: |         try: | ||||||
|             doc = frappe.get_doc("Remote Connection Sessions", session["name"]) |             doc = frappe.get_doc("Remote Connection Sessions", session["name"]) | ||||||
|             doc.protocol = protocol |             doc.it_object = session_data['it_object'] | ||||||
|             doc.host = host |             doc.protocol = session_data['protocol'] | ||||||
|             doc.user = user |             doc.host = session_data['host'] | ||||||
|  |             doc.user = session_data['user'] | ||||||
|  |             doc.ip_user = session_data['ip_user'] | ||||||
|             doc.save() |             doc.save() | ||||||
|             frappe.db.commit() |             frappe.db.commit() | ||||||
|             frappe.logger().info(f"Session {session['id']} updated in Frappe") |             frappe.logger().info(f"Session {session['id']} updated in Frappe") | ||||||
| @ -127,5 +129,14 @@ def create_session(name, protocol): | |||||||
|                 if params: |                 if params: | ||||||
|                     uri = f"{uri}/?{'&'.join(params)}" |                     uri = f"{uri}/?{'&'.join(params)}" | ||||||
|             url = f'{guaca_config.guacamole_server}/?#/?token={token}&quickconnect={urllib.parse.quote(uri)}' |             url = f'{guaca_config.guacamole_server}/?#/?token={token}&quickconnect={urllib.parse.quote(uri)}' | ||||||
|             frappe.enqueue(log_guacamole_session, queue='short', url=guaca_config.guacamole_server, protocol=protocol, host=ip_address, user=frappe.session.user) |             frappe.enqueue( | ||||||
|  |                 log_guacamole_session,  | ||||||
|  |                 queue='short',  | ||||||
|  |                 session_data={ | ||||||
|  |                     'it_object': doc.name, | ||||||
|  |                     'protocol': protocol, | ||||||
|  |                     'host': ip_address, | ||||||
|  |                     'user': frappe.session.user, | ||||||
|  |                     'ip_user': frappe.local.request_ip | ||||||
|  |                 } | ||||||
|             return { 'url': url, 'resolution': guaca_config.resolution if guaca_config.get('resolution') else '800x600'} |             return { 'url': url, 'resolution': guaca_config.resolution if guaca_config.get('resolution') else '800x600'} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user