fix: Only a System Manager can register as a seller

- every other user has read only access
This commit is contained in:
Faris Ansari
2018-08-29 15:02:39 +05:30
parent 8bc954ecc6
commit 64202ad416
3 changed files with 18 additions and 6 deletions

View File

@@ -162,14 +162,23 @@ def load_base64_image_from_items(items):
def get_hub_connection():
read_only = True
if frappe.db.exists('Data Migration Connector', 'Hub Connector'):
hub_connector = frappe.get_doc('Data Migration Connector', 'Hub Connector')
hub_connection = hub_connector.get_connection()
return hub_connection.connection
# full rights to user who registered as hub_seller
if hub_connector.username == frappe.session.user:
read_only = False
if not read_only:
hub_connection = hub_connector.get_connection()
return hub_connection.connection
# read-only connection
hub_connection = FrappeClient(frappe.conf.hub_url)
return hub_connection
if read_only:
hub_connection = FrappeClient(frappe.conf.hub_url)
return hub_connection
def get_field_mappings():