Fixed Maintenance Schedule Event Permission checking. Moved prepare_for_save before permission checking in save().
This commit is contained in:
parent
2e73b1a188
commit
090461c8a2
2 changed files with 9 additions and 6 deletions
|
|
@ -36,10 +36,11 @@ class DocType():
|
|||
if self.doc.attached_to_name:
|
||||
# check persmission
|
||||
try:
|
||||
if not frappe.has_permission(self.doc.attached_to_doctype,
|
||||
"write", self.doc.attached_to_name):
|
||||
frappe.msgprint(frappe._("No permission to write / remove."),
|
||||
raise_exception=True)
|
||||
if not self.bean.ignore_permissions and \
|
||||
not frappe.has_permission(self.doc.attached_to_doctype, "write", self.doc.attached_to_name):
|
||||
|
||||
frappe.msgprint(frappe._("No permission to write / remove."), raise_exception=True)
|
||||
|
||||
except frappe.DoesNotExistError:
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -302,9 +302,11 @@ class Bean:
|
|||
if not self.doc.owner:
|
||||
self.doc.owner = frappe.session.user
|
||||
|
||||
self.to_docstatus = 0
|
||||
self.prepare_for_save("save")
|
||||
|
||||
# check permissions after preparing for save, since name might be required
|
||||
if self.ignore_permissions or frappe.has_permission(self.doc.doctype, perm_to_check, self.doc):
|
||||
self.to_docstatus = 0
|
||||
self.prepare_for_save("save")
|
||||
if not self.ignore_validate:
|
||||
self.run_method('validate')
|
||||
self.validate_doclist()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue