2018-10-05 01:50:45 +03:00
|
|
|
module.exports = {
|
|
|
|
get permissions() {
|
|
|
|
return require('./permissions');
|
|
|
|
},
|
|
|
|
|
|
|
|
get serializers() {
|
|
|
|
return require('./serializers');
|
|
|
|
},
|
|
|
|
|
|
|
|
get validators() {
|
|
|
|
return require('./validators');
|
2018-11-06 15:06:22 +03:00
|
|
|
},
|
|
|
|
|
2019-05-06 15:24:12 +03:00
|
|
|
/**
|
|
|
|
* @description Does the request access the Content API?
|
|
|
|
*
|
|
|
|
* Each controller is either for the Content or for the Admin API.
|
|
|
|
* When Ghost registers each controller, it currently passes a String "content" if the controller
|
|
|
|
* is a Content API implementation - see index.js file.
|
|
|
|
*
|
|
|
|
* @TODO: Move this helper function into a utils.js file.
|
|
|
|
* @param {Object} frame
|
|
|
|
* @return {boolean}
|
|
|
|
*/
|
2018-11-06 15:06:22 +03:00
|
|
|
isContentAPI: (frame) => {
|
2019-02-25 21:52:45 +03:00
|
|
|
return frame.apiType === 'content';
|
2019-01-31 17:35:22 +03:00
|
|
|
},
|
|
|
|
|
2019-05-06 15:24:12 +03:00
|
|
|
// @TODO: Remove, not used.
|
2019-01-31 17:35:22 +03:00
|
|
|
isAdminAPIKey: (frame) => {
|
|
|
|
return frame.options.context && Object.keys(frame.options.context).length !== 0 && frame.options.context.api_key &&
|
|
|
|
frame.options.context.api_key.type === 'admin';
|
2018-10-05 01:50:45 +03:00
|
|
|
}
|
|
|
|
};
|