(user)
return user.analytics_enabled
Check if a user (or account policy) has given permission for Hubspot
    analytics to be synced for a given user.
    :param user: CouchUser or WebUser
    :return: Boolean (True if hubspot is enabled/allowed)
Check if a user (or account policy) has given permission for Hubspot
    analytics to be synced for a given user.
    :param user: CouchUser or WebUser
    :return: Boolean (True if hubspot is enabled/allowed)
Check if a user ( or account policy ) has given permission for Hubspot analytics to be synced for a given user . : param user : CouchUser or WebUser : return : Boolean ( True if hubspot is enabled / allowed )
def hubspot_enabled_for_user(user):
    """
    Check if a user (or account policy) has given permission for Hubspot
    analytics to be synced for a given user.
    :param user: CouchUser or WebUser
    :return: Boolean (True if hubspot is enabled/allowed)
    """
    if isinstance(user, WebUser):
        web_user = user
    else:
        web_user = WebUser.get_by_username(user.username)
    if web_user:
        for domain in web_user.get_domains():
            if is_domain_blocked_from_hubspot(domain):
                return False
        if has_user_accepted_invitation_to_blocked_hubspot_domain(web_user):
            return False
    else:
        commcare_user = CommCareUser.get_by_username(user.username)
        if is_domain_blocked_from_hubspot(commcare_user.domain):
            return False
    return user.analytics_enabled
def hubspot_enabled_for_user ( user ) : if isinstance ( user , WebUser ) : web_user = user else : web_user = WebUser . get_by_username ( user . username ) if web_user : for domain in web_user . get_domains ( ) : if is_domain_blocked_from_hubspot ( domain ) : return False if has_user_accepted_invitation_to_blocked_hubspot_domain ( web_user ) : return False else : commcare_user = CommCareUser . get_by_username ( user . username ) if is_domain_blocked_from_hubspot ( commcare_user . domain ) : return False return user . analytics_enabled