2014-01-14 2 views
0

자동 게시 또는 안전하지 않은 패키지를 제거하지 않았지만 Meteor.user()를 실행할 때 서비스를 표시합니다. Facebook 객체이지만 services.google 객체는 아니며 services.password도 필요하지 않지만 그 객체는 필요하지 않습니다.Meteor가 자동 게시 패키지가있는 모든 사용자 필드를 게시하지 않습니다.

Google 및 Facebook 개체는 확실히 데이터베이스에 모두 있는데, 왜 하나만 표시할까요? 문제 해결에 대해 어떻게 생각하십니까? 나는 autupub가 켜져있을 때 모든 분야가 삐걱 거리다는 생각.

답변

2

먼저 "accounts-base", "accounts-facebook"및 "accounts-google"이 ".meteor/packages"파일에 있는지 확인하십시오. 모든 것은 당신이 그 파일에 "accounts-google"패키지를 추가하지 않았 음을 나타냅니다.

"Meteor.users"를 게시하는 "accounts-base"패키지는 기본 자동 게시 기능 (https://github.com/meteor/meteor/blob/devel/packages/accounts-base/accounts_common.js#L82)을 덮어 씁니다. https://github.com/meteor/meteor/blob/devel/packages/accounts-base/accounts_server.js#L683

당신은 (설명을 읽기) 다음 볼 수 있습니다 :

// If autopublish is on, publish these user fields. Login service 
// packages (eg accounts-google) add to these by calling 
// Accounts.addAutopublishFields Notably, this isn't implemented with 
// multiple publishes since DDP only merges only across top-level 
// fields, not subfields (such as 'services.facebook.accessToken') 
var autopublishFields = { 
    loggedInUser: ['profile', 'username', 'emails'], 
    otherUsers: ['profile', 'username'] 
}; 

는 의미 자동 accounts_server.js에서 소스 코드를 참조 출간 어떤 필드

을 보려면이 시작 "accountss.addAutopublishFields"메소드는 "accounts-google", "accounts-facebook"등의 패키지에 의해 호출되어 그 발행물에 필드를 추가합니다. 당신이있는 경우

Accounts.addAutopublishFields({ 
    forLoggedInUser: _.map(
     // publish access token since it can be used from the client (if 
     // transmitted over ssl or on 
     // localhost). https://developers.google.com/accounts/docs/OAuth2UserAgent 
     // refresh token probably shouldn't be sent down. 
     Google.whitelistedFields.concat(['accessToken', 'expiresAt']), // don't publish refresh token 
     function (subfield) { return 'services.google.' + subfield; }), 

    forOtherUsers: _.map(
     // even with autopublish, no legitimate web app should be 
     // publishing all users' emails 
     _.without(Google.whitelistedFields, 'email', 'verified_email'), 
     function (subfield) { return 'services.google.' + subfield; }) 
    }); 

의미합니다 포장은 "계정 - 구글"을 사용하는 것이 :

지금 예를 들어, 당신은 다음과 같은있다은 "google.js"파일에서 "accounts-google" package를 보면

로그인 : '프로필', '이름', '이메일'과 'accessToken'를 제외한 모든 "service.google"필드 'expiresAt'

다음과 같은 필드에 "Meteor.users을"발행

로그 아웃 : '프로필', '사용자 이름'및 '이메일', 'verified_email'을 제외한 모든 "service.google"필드

"accounts-facebook"패키지와 동일합니다.

+0

내 프로젝트에서 어디에 보이지 않습니다. 빌드 폴더에서 파일을 변경하면 덮어 씌어진 것 같습니다. 소스 파일은 어디에 있습니까? 나는 왜 페이스 북이 출판되고 있는지에 관해서 혼란스러워하고있다. 그 패키지는 그것을 출판하고있을 것임에 틀림 없다. – timmyg13

+0

원본 답변에 몇 가지 세부 정보를 추가했습니다. 이 패키지는 기본 패키지이므로 Meteor는 프로젝트에 있지 않으므로 자동 게시와 마찬가지로 ".meteor/packages"파일에 추가 될 때 자동으로 번들됩니다. 여기에서 Meteor 소스 코드를 복제 할 수 있습니다 : https://github.com/meteor/meteor – FredericoC

관련 문제