Faris Ansari | fd345f8 | 2017-10-05 11:17:30 +0530 | [diff] [blame^] | 1 | # Copyright (c) 2015, Web Notes Technologies Pvt. Ltd. and Contributors and contributors |
| 2 | # For license information, please see license.txt |
| 3 | |
| 4 | |
| 5 | import frappe, json |
| 6 | from frappe.utils import now, nowdate |
| 7 | from erpnext.hub_node.doctype.hub_settings.hub_settings import get_hub_settings |
| 8 | |
| 9 | # API wrapper |
| 10 | @frappe.whitelist(allow_guest=True) |
| 11 | def 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 | |
| 22 | def 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) |