I want to hide create workspace button by roles

Screenshot from 2023-11-08 11-08-27

1 Like

@abhirock74 You van add server script on Before Insert & script type will be Doctype Event.

Code :

user = frappe.session.user
is_admin = frappe.db.get_value(“Has Role”, {“role”: “System Manager”, “parent”: user}, “name”) is not None
if not is_admin:
frappe.throw(“To Create Workspace Need An Admin Previleges”, frappe.ValidationError)

is there any valid reason to restrict end users from personalizing their own workspaces? :thinking:

Public workspaces can only be created by users with Workspace Manager role by default.

1 Like