Notes
The example script checks to see if the currently logged in user has the capability to create and edit Client Scripts (client_script_admin role). Note that the script returns true not only when the currently logged in user has the role assigned but also if the currently logged in user has the admin role. The admin user has all roles implicitly assigned. To test whether the currently logged in user has the role explicitly assigned, use the hasRoleExactly() method:
g_user.hasRoleExactly('client_script_admin');
https://developer.servicenow.com/dev.do#!/learn/courses/washingtondc/app_store_learnv2_scripting_washingtondc_scripting_in_servicenow/app_store_learnv2_scripting_washingtondc_client_side_scripting/app_store_learnv2_scripting_washingtondc_the_glideuser_g_user_class