Leads or Deals Restriction

How do I set up Frappe CRM like this?

Manager: Can view, edit, or delete all leads and deals.

User: Can only view or edit leads and deals assigned to the user, or leads that haven’t been assigned to anyone else with a new or open status. And can’t view or modify leads/deals assigned to other users.

I’ve tried various user permission settings but haven’t found the one I want.

Anyone can help me please? Cz another user still can view/edit leads has assigned user.

In the doctype settings → Expand the Permission Rules → You should see a tickbox “
If user is the owner”

u can use client script or server method to get the assigned users emails and makes the fields 0 or 1 based on your requirments

there is also a way where u can set filters that a user only sees the leads assigned to them and can edit them