Ghost/core/server/services/permissions/index.js
naz 8ddf83f3c5
Fixed "no-shadow" linting error in server modules (#12287)
refs 143921948d

- Continuation of changes started in referenced commit
2020-10-20 12:02:56 +13:00

25 lines
684 B
JavaScript

// canThis(someUser).edit.posts([id]|[[ids]])
// canThis(someUser).edit.post(somePost|somePostId)
const models = require('../../models');
const actionsMap = require('./actions-map-cache');
const init = function init(options) {
options = options || {};
// Load all the permissions
return models.Permission.findAll(options)
.then(function (permissionsCollection) {
return actionsMap.init(permissionsCollection);
});
};
module.exports = {
init: init,
canThis: require('./can-this'),
// @TODO: Make it so that we don't need to export these
parseContext: require('./parse-context'),
applyPublicRules: require('./public')
};