ERPNext Conference 2019* ERPNext.com Blog

Get user roles in controllers


#1

Hi, in my som_modules.py i want to add validate by the roles, how i can do this? how i can get the roles?

Thanks


#2

Try frappe.get_roles() to get the roles of the current user.


#3

How do we do the same in client side?
and how can we check for a specific role for logged in user in client side?


#4

okey Found it .

frappe.user.has_role(“Role”)


#5

frappe.user.has_role(“Role”) will fetch all the users with role Role? Isn’t working for me.


#6

Just to update, it is now frappe.user_roles in “Frappe Framework: v11.1.44 (master)” version