{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":162,"path":"api-reference/GlideUserAPINX.md","title":"GlideUser \\(Next Experience\\) - Client","bundle":null,"doc_type":null,"release":"australia","body":"\n# GlideUser \\(Next Experience\\)- Client\n\nThe GlideUser API provides a method to access information about current user roles in the Next Experience UI Framework.\n\nGlideUser methods are accessed through a global object \\(`g_user`\\) that is only available in client scripts.\n\n**Parent Topic:**[Client Next Experience API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/api-client-next.md)\n\n## GlideUser \\(Next Experience\\) - getRoles\\(\\)\n\nReturns all roles assigned to the current user.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|Array|Array of roles assigned to the current user. Includes explicitly granted roles, inherited roles, and roles acquired by group membership.|\n\nThis example checks if the current user has the admin role.\n\n```\nif (g_user.getRoles().indexOf('admin') !== -1) {\n    console.log('User is admin');\n}\n```\n\nOutput:\n\n```\nUser is admin\n```\n\nThis example logs all roles assigned to the current user.\n\n```\nfunction onChange(control, oldValue, newValue, isLoading, isTemplate) {\n   if (isLoading || newValue === '') {\n      return;\n   }\n   console.log(g_user.getRoles());\n}\n```\n\nOutput:\n\n```\n['actsub_user', 'sn_publications_recipients_list_user', 'sn_publications.author', 'interaction_agent', 'interaction_admin', 'image_admin', 'sn_publications_recipients_user', 'workflow_publisher', 'knowledge']\n```\n\n"}}