mirror of
https://github.com/itsdave-de/msp_remoteadmin.git
synced 2025-05-06 12:25:12 +02:00
fix renamed doctypes
This commit is contained in:
parent
b49a5a6ac1
commit
67dc98e6ee
@ -17,7 +17,7 @@ PROTOCOL_PORT = {
|
|||||||
def log_start_session(session_id, start_time):
|
def log_start_session(session_id, start_time):
|
||||||
try:
|
try:
|
||||||
doc = frappe.get_doc({
|
doc = frappe.get_doc({
|
||||||
"doctype": "Remote Connection Sessions",
|
"doctype": "Remote Connection Session",
|
||||||
"id": session_id,
|
"id": session_id,
|
||||||
"start_datetime": datetime.strptime(start_time, "%Y-%m-%dT%H:%M:%S.%f")
|
"start_datetime": datetime.strptime(start_time, "%Y-%m-%dT%H:%M:%S.%f")
|
||||||
})
|
})
|
||||||
@ -32,7 +32,7 @@ def log_start_session(session_id, start_time):
|
|||||||
@frappe.whitelist(allow_guest=True)
|
@frappe.whitelist(allow_guest=True)
|
||||||
def log_end_session(session_id, end_time):
|
def log_end_session(session_id, end_time):
|
||||||
active_session = frappe.get_all(
|
active_session = frappe.get_all(
|
||||||
"Remote Connection Sessions",
|
"Remote Connection Session",
|
||||||
filters={
|
filters={
|
||||||
"id": session_id,
|
"id": session_id,
|
||||||
"end_datetime": ["is", "not set"]
|
"end_datetime": ["is", "not set"]
|
||||||
@ -40,7 +40,7 @@ def log_end_session(session_id, end_time):
|
|||||||
fields=["name"]
|
fields=["name"]
|
||||||
)
|
)
|
||||||
if active_session:
|
if active_session:
|
||||||
doc = frappe.get_doc("Remote Connection Sessions", active_session[0]["name"])
|
doc = frappe.get_doc("Remote Connection Session", active_session[0]["name"])
|
||||||
doc.end_datetime = datetime.strptime(end_time, "%Y-%m-%dT%H:%M:%S.%f")
|
doc.end_datetime = datetime.strptime(end_time, "%Y-%m-%dT%H:%M:%S.%f")
|
||||||
doc.save(ignore_permissions=True)
|
doc.save(ignore_permissions=True)
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
@ -54,7 +54,7 @@ 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(
|
||||||
"Remote Connection Sessions",
|
"Remote Connection Session",
|
||||||
filters={
|
filters={
|
||||||
"protocol": ["is", "not set"],
|
"protocol": ["is", "not set"],
|
||||||
"host": ["is", "not set"],
|
"host": ["is", "not set"],
|
||||||
@ -65,7 +65,7 @@ def log_guacamole_session(session_data):
|
|||||||
)
|
)
|
||||||
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 Session", session["name"])
|
||||||
doc.it_object = session_data['it_object']
|
doc.it_object = session_data['it_object']
|
||||||
doc.protocol = session_data['protocol']
|
doc.protocol = session_data['protocol']
|
||||||
doc.host = session_data['host']
|
doc.host = session_data['host']
|
||||||
@ -79,7 +79,7 @@ def log_guacamole_session(session_data):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def create_session(name, protocol):
|
def create_session(name, protocol):
|
||||||
guaca_config = frappe.get_single('Remote Connections Settings')
|
guaca_config = frappe.get_single('Remote Connection Settings')
|
||||||
guacamole_api = f'{guaca_config.guacamole_server}/api/tokens'
|
guacamole_api = f'{guaca_config.guacamole_server}/api/tokens'
|
||||||
auth = {
|
auth = {
|
||||||
'username': guaca_config.guacamole_user,
|
'username': guaca_config.guacamole_user,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user