g_user.hasRole is returning false if users have external roles. If user has snc_external role and any other internal role like 'itil' role g_user.hasRole for itil will return even though user has this role.
This behavior is expected. snc_external is a special role which is used to indicate a user is an external user. getRole() for an external user always return false since by definition an external user has no role on an instance.
Here is the documentation about it: The hasRoles() method