Merge pull request #134 from ankush/redundant_guest
fix: remove redundant guest checks
This commit is contained in:
commit
ed52d15cd4
@ -4,9 +4,6 @@ from frappe.query_builder import Order
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_notifications():
|
def get_notifications():
|
||||||
if frappe.session.user == "Guest":
|
|
||||||
frappe.throw("Authentication failed", exc=frappe.AuthenticationError)
|
|
||||||
|
|
||||||
Notification = frappe.qb.DocType("CRM Notification")
|
Notification = frappe.qb.DocType("CRM Notification")
|
||||||
query = (
|
query = (
|
||||||
frappe.qb.from_(Notification)
|
frappe.qb.from_(Notification)
|
||||||
@ -46,9 +43,6 @@ def get_notifications():
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def mark_as_read(user=None, comment=None):
|
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
|
user = user or frappe.session.user
|
||||||
filters = {"to_user": user, "read": False}
|
filters = {"to_user": user, "read": False}
|
||||||
if comment:
|
if comment:
|
||||||
|
|||||||
@ -1,11 +1,8 @@
|
|||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist(allow_guest=True)
|
@frappe.whitelist()
|
||||||
def get_users():
|
def get_users():
|
||||||
if frappe.session.user == "Guest":
|
|
||||||
frappe.throw("Authentication failed", exc=frappe.AuthenticationError)
|
|
||||||
|
|
||||||
users = frappe.qb.get_query(
|
users = frappe.qb.get_query(
|
||||||
"User",
|
"User",
|
||||||
fields=["name", "email", "enabled", "user_image", "full_name", "user_type"],
|
fields=["name", "email", "enabled", "user_image", "full_name", "user_type"],
|
||||||
@ -24,9 +21,6 @@ def get_users():
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_contacts():
|
def get_contacts():
|
||||||
if frappe.session.user == "Guest":
|
|
||||||
frappe.throw("Authentication failed", exc=frappe.AuthenticationError)
|
|
||||||
|
|
||||||
contacts = frappe.get_all(
|
contacts = frappe.get_all(
|
||||||
"Contact",
|
"Contact",
|
||||||
fields=[
|
fields=[
|
||||||
@ -66,9 +60,6 @@ def get_contacts():
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_lead_contacts():
|
def get_lead_contacts():
|
||||||
if frappe.session.user == "Guest":
|
|
||||||
frappe.throw("Authentication failed", exc=frappe.AuthenticationError)
|
|
||||||
|
|
||||||
lead_contacts = frappe.get_all(
|
lead_contacts = frappe.get_all(
|
||||||
"CRM Lead",
|
"CRM Lead",
|
||||||
fields=[
|
fields=[
|
||||||
@ -88,9 +79,6 @@ def get_lead_contacts():
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_organizations():
|
def get_organizations():
|
||||||
if frappe.session.user == "Guest":
|
|
||||||
frappe.throw("Authentication failed", exc=frappe.AuthenticationError)
|
|
||||||
|
|
||||||
organizations = frappe.qb.get_query(
|
organizations = frappe.qb.get_query(
|
||||||
"CRM Organization",
|
"CRM Organization",
|
||||||
fields=['*'],
|
fields=['*'],
|
||||||
|
|||||||
@ -4,9 +4,6 @@ from pypika import Criterion
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_views(doctype):
|
def get_views(doctype):
|
||||||
if frappe.session.user == "Guest":
|
|
||||||
frappe.throw("Authentication failed", exc=frappe.AuthenticationError)
|
|
||||||
|
|
||||||
View = frappe.qb.DocType("CRM View Settings")
|
View = frappe.qb.DocType("CRM View Settings")
|
||||||
query = (
|
query = (
|
||||||
frappe.qb.from_(View)
|
frappe.qb.from_(View)
|
||||||
|
|||||||
@ -93,7 +93,7 @@ def get_call_log(name):
|
|||||||
if c:
|
if c:
|
||||||
return [c.full_name, c.image]
|
return [c.full_name, c.image]
|
||||||
return [None, None]
|
return [None, None]
|
||||||
|
|
||||||
def get_lead_contact(number):
|
def get_lead_contact(number):
|
||||||
l = frappe.db.get_value("CRM Lead", {"mobile_no": number, "converted": 0}, ["lead_name", "image"], as_dict=True)
|
l = frappe.db.get_value("CRM Lead", {"mobile_no": number, "converted": 0}, ["lead_name", "image"], as_dict=True)
|
||||||
if l:
|
if l:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user