def has_website_permission(doc, ptype, user, verbose=False):
 contact_name = frappe.db.get_value(u'Contact', {u'email_id': frappe.session.user})
 if contact_name:
  contact = frappe.get_doc(u'Contact', contact_name)
  return contact.has_common_link(doc)
  lead_name = frappe.db.get_value(u'Lead', {u'email_id': frappe.session.user})
  if lead_name:
   return doc.has_link(u'Lead', lead_name)
 return False

def has_website_permission ( doc , ptype , user , verbose = False ) : contact_name = frappe . db . get_value ( u'Contact' , { u'email_id' : frappe . session . user } ) if contact_name : contact = frappe . get_doc ( u'Contact' , contact_name ) return contact . has_common_link ( doc ) lead_name = frappe . db . get_value ( u'Lead' , { u'email_id' : frappe . session . user } ) if lead_name : return doc . has_link ( u'Lead' , lead_name ) return False
returns true if there is a related lead or contact related to this document .