Added check to ensure that the request object has a user attribute