function(doc) {
    if (doc.doc_type == "CommCareUser" && doc.location_id) {
        emit([doc.location_id, doc._id], null);
    }
}

function(doc) {
    if (doc.base_doc === "CouchUser") {

        if (doc.doc_type === "CommCareUser" && doc.location_id) {
            emit([doc.location_id, doc.doc_type, doc._id], null);

        } else if (doc.doc_type === "WebUser") {
            for (i = 0; i < doc.domain_memberships.length; i += 1) {
                var domain_membership = doc.domain_memberships[i];
                if (domain_membership.location_id) {
                    emit([domain_membership.location_id, doc.doc_type, doc._id], null);
                }
            }
        }
    }
}

Add web users to users_by_location_id view
Add web users to users_by_location_id view
