Merge pull request #134 from ankush/redundant_guest

fix: remove redundant guest checks
This commit is contained in:
Shariq Ansari 2024-04-13 01:54:14 +05:30 committed by GitHub
commit ed52d15cd4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 2 additions and 23 deletions

View File

@ -4,9 +4,6 @@ from frappe.query_builder import Order
@frappe.whitelist()
def get_notifications():
if frappe.session.user == "Guest":
frappe.throw("Authentication failed", exc=frappe.AuthenticationError)
Notification = frappe.qb.DocType("CRM Notification")
query = (
frappe.qb.from_(Notification)
@ -46,9 +43,6 @@ def get_notifications():
@frappe.whitelist()
def mark_as_read(user=None, comment=None):
if frappe.session.user == "Guest":
frappe.throw("Authentication failed", exc=frappe.AuthenticationError)
user = user or frappe.session.user
filters = {"to_user": user, "read": False}
if comment:

View File

@ -1,11 +1,8 @@
import frappe
@frappe.whitelist(allow_guest=True)
@frappe.whitelist()
def get_users():
if frappe.session.user == "Guest":
frappe.throw("Authentication failed", exc=frappe.AuthenticationError)
users = frappe.qb.get_query(
"User",
fields=["name", "email", "enabled", "user_image", "full_name", "user_type"],
@ -24,9 +21,6 @@ def get_users():
@frappe.whitelist()
def get_contacts():
if frappe.session.user == "Guest":
frappe.throw("Authentication failed", exc=frappe.AuthenticationError)
contacts = frappe.get_all(
"Contact",
fields=[
@ -66,9 +60,6 @@ def get_contacts():
@frappe.whitelist()
def get_lead_contacts():
if frappe.session.user == "Guest":
frappe.throw("Authentication failed", exc=frappe.AuthenticationError)
lead_contacts = frappe.get_all(
"CRM Lead",
fields=[
@ -88,9 +79,6 @@ def get_lead_contacts():
@frappe.whitelist()
def get_organizations():
if frappe.session.user == "Guest":
frappe.throw("Authentication failed", exc=frappe.AuthenticationError)
organizations = frappe.qb.get_query(
"CRM Organization",
fields=['*'],

View File

@ -4,9 +4,6 @@ from pypika import Criterion
@frappe.whitelist()
def get_views(doctype):
if frappe.session.user == "Guest":
frappe.throw("Authentication failed", exc=frappe.AuthenticationError)
View = frappe.qb.DocType("CRM View Settings")
query = (
frappe.qb.from_(View)

View File

@ -93,7 +93,7 @@ def get_call_log(name):
if c:
return [c.full_name, c.image]
return [None, None]
def get_lead_contact(number):
l = frappe.db.get_value("CRM Lead", {"mobile_no": number, "converted": 0}, ["lead_name", "image"], as_dict=True)
if l: