Restrict User Permissions

I want change the Lead Owner field and change it to another user which do not have access or is not under his hierarchy. How can I achieve that using custom script?

Please Help!

please provide more details like your bench - frappe - foundation version and few screenshots on what you would like to link or script, thanks.

Hi @bharat_Suthar thank you for reply.
Use Case :-

  1. User A == User A (Lead Access).
  2. User A want to assign or change the owner to another User B. (it’s giving to Permission Error).

… etc

have you applied any permission to userB can you please share these.
and are you using any custom apps.

Yes, I have applied permission to User B.

No, not using custom App.