fix: do not allow editing other's private workspaces

This commit is contained in:
Shariq Ansari 2023-10-17 19:39:53 +05:30
parent f1c394cafc
commit 7343c83838

View file

@ -289,6 +289,16 @@ def update_page(name, title, icon, indicator_color, parent, public):
public = frappe.parse_json(public)
doc = frappe.get_doc("Workspace", name)
if (
not doc.get("public")
and doc.get("for_user") != frappe.session.user
and not is_workspace_manager()
):
frappe.throw(
_("Need Workspace Manager role to edit private workspace of other users"),
frappe.PermissionError,
)
if doc:
doc.title = title
doc.icon = icon