2014-11-10 5 views
0

관련 : StrongLoop: hiding method updateAttributes(), 그러나 허용 된 대답으로 내 문제가 해결되지 않습니다.updateAttributes 메서드를 숨길 수 없습니다.

기본 앱 설정을 얻으려면 시작 가이드를 따라야합니다. 이 앱에서는 내 유일한 모델을 약국이라고하며, REST API에서 모든 변경 기능 (예 : 삭제, 업데이트, 생성 ...)을 숨기려고합니다.

설명서 (http://docs.strongloop.com/display/public/LB/Exposing+models+over+REST#ExposingmodelsoverREST-HidingmethodsandRESTendpoints)의 지침을 따르고 있습니다. 정적 함수를 잘 숨길 수는 있지만 updateAttributes 메서드는 내가하는 일과 관계없이 노출되어 있습니다.

내 숨겨진 로직을 common/models/pharmacy.js에 배치했습니다. docs에 표시된대로 server/pharmacy.js에 파일을 배치해도 파일은로드되지 않으므로 아무 작업도 수행하지 않습니다.

일반/모델/pharmacy.js의 내용은 다음과 같습니다 내가 잘못 뭐하는 거지

module.exports = function(Pharmacy) { 
     Pharmacy.sharedClass.find('deleteById', true).shared = false; 
     Pharmacy.sharedClass.find('updateAttributes', false).shared = false; 
     Pharmacy.sharedClass.find('upsert', true).shared = false; 
     Pharmacy.sharedClass.find('create', true).shared = false; 
}; 

? 미리 감사드립니다!

답변

1

devs에서 매우 도움이되는 이메일을 보낸 다음이 문제를 해결할 수 있습니다. 파일은 다음과 같아야합니다.

module.exports = function(Pharmacy) { 
     Pharmacy.disableRemoteMethod('deleteById', true); 
     Pharmacy.disableRemoteMethod('updateAttributes', false); 
     Pharmacy.disableRemoteMethod('updateAll', true); 
     Pharmacy.disableRemoteMethod('upsert', true); 
     Pharmacy.disableRemoteMethod('create', true); 
}; 
관련 문제