User Roles and User Permissions

Hello

I have added a code to create user emissions on issues and tasks after saving of user.

and I want to auto-delete the user permissions on tasks and issues when the user has a role “Support Team”

How can I do that?

after_save(frm)
	{
	     if(frappe.user.has_role("Support Team"))
	     {
	         console.log("Hello")
	     }
	}

I did this code to check the user has the role “Support Team”, but not working.
It also works for the users with no role as a “Support Team”.

And I want to check
after saving, whether the user has the role “Support Team” or not.
if yes delete the permission

if no role nothing do.

Please help me with this

Hi @jinsy,

Use it and check it.

frappe.user_roles.indexOf("Support Team")==-1

Thank You!

It also works for 2 users with has roles and without