blob: b32efd9799f4a1f3ec558a9acb214b63646d72dd [file] [log] [blame]
Faris Ansarifd345f82017-10-05 11:17:30 +05301# Copyright (c) 2015, Web Notes Technologies Pvt. Ltd. and Contributors and contributors
2# For license information, please see license.txt
3
4
5import frappe, json
6from frappe.utils import now, nowdate
7from erpnext.hub_node.doctype.hub_settings.hub_settings import get_hub_settings
8
9# API wrapper
10@frappe.whitelist(allow_guest=True)
11def call_method(access_token, method, message):
12 try:
13 args = json.loads(message)
14 if args:
15 return globals()[method](access_token, args)
16 else:
17 return globals()[method](access_token)
18 except:
19 print("Client Exception")
20 print(frappe.get_traceback())
21
22def disable_and_suspend_hub_user(access_token):
23 hub_settings = get_hub_settings()
24 hub_settings.publish = 0
25 hub_settings.publish_pricing = 0
26 hub_settings.publish_availability = 0
27 hub_settings.suspended = 1
28 hub_settings.enabled = 0
29 hub_settings.save(ignore_permissions=True)