Merge pull request #2004 from pateljannat/issues-173

fix: allow enabled server script endpoints
This commit is contained in:
Jannat Patel
2026-01-19 18:33:51 +05:30
committed by GitHub
3 changed files with 11 additions and 9 deletions
+10
View File
@@ -61,6 +61,16 @@ def authenticate():
if path.startswith("/lms") or path.startswith("/api/method/lms."):
return
if is_server_script_path(path):
return
if path in ALLOWED_PATHS:
return
frappe.throw(f"Access not allowed for this URL: {path}", frappe.PermissionError)
def is_server_script_path(path):
endpoint = path.split("/api/method/")[-1]
if frappe.db.exists("Server Script", {"script_type": "API", "api_method": endpoint, "disabled": 0}):
return True
return False
-8
View File
@@ -3,14 +3,6 @@
frappe.ui.form.on("LMS Batch", {
onload: function (frm) {
frm.set_query("student", "students", function (doc) {
return {
filters: {
ignore_user_type: 1,
},
};
});
frm.set_query("reference_doctype", "timetable", function () {
let doctypes = ["Course Lesson", "LMS Quiz", "LMS Assignment"];
return {
+1 -1
View File
@@ -37,7 +37,7 @@ class LMSBatch(Document):
def on_update(self):
if self.has_value_changed("published") and self.published:
frappe.enqueue(send_notification_for_published_batch, batch=self, now=True)
frappe.enqueue(send_notification_for_published_batch, batch=self)
def autoname(self):
if not self.name: