fix(permissions): restrict deletes and admin member management

This commit is contained in:
2026-04-28 10:02:37 +03:30
parent 02c9c17c30
commit afb1a55570
9 changed files with 157 additions and 37 deletions

View File

@@ -19,11 +19,13 @@ def create_client(user, workspace_id, name, notes=""):
if Client.objects.filter(workspace_id=workspace_id, name=name, is_deleted=False).exists():
raise ValidationError({"name": "مشتری با این نام در این فضای کاری وجود دارد."})
return Client.objects.create(
workspace_id=workspace_id,
name=name,
notes=notes
)
return Client.objects.create(
workspace_id=workspace_id,
name=name,
notes=notes,
created_by=user,
updated_by=user,
)
def update_client(client, name=None, notes=None):