Get user role from web page scripts

I am trying to restrict access to a webpage to a webpage on a hosted ERP Next instance for specific roles. The custom scripts used in form scripting to get roles, for example, frappe.user.has_role(‘name_of_role’) or frappe.user_roles do not work for web pages under the script field shown in the screenshot below

Try

has_common(frappe.user_roles, [“Role 1”,“Role 2”])

1 Like

Thanks for the quick response @sagarg ,but unfortunately i am getting a syntax error using has_common(frappe.user_roles, [“Role 1”,“Role 2”]) . Apart from that i feel that this is a comparative function compairing the value of frappe.user_roles and specific roles e.g [“Role 1”,“Role 2”] but this will ideally not work because frappe.user_roles is undefined in the first place.

I am facing the same issue. any results?
thanks

change the double quote from “” to straight double quote