1db3aefb9b
refs https://github.com/TryGhost/Ghost/issues/9865 - schema migrations - adds `integrations` and `api_keys` tables - inserts `integration` and `api_key` permissions and Administrator role relationships - inserts `Admin Integration` role and permissions - adds `Integration` model - adds `ApiKey` model - creates default secret if not given - hardcodes associated role based on key type - `admin` = `Admin API Client` - `content` = no role - updates `Role` model to use `bookshelf-relations` for auto cleanup of permission relationships on destroy
52 lines
711 B
JavaScript
52 lines
711 B
JavaScript
/**
|
|
* Dependencies
|
|
*/
|
|
|
|
var _ = require('lodash'),
|
|
exports,
|
|
models;
|
|
|
|
// enable event listeners
|
|
require('./base/listeners');
|
|
|
|
/**
|
|
* Expose all models
|
|
*/
|
|
exports = module.exports;
|
|
|
|
models = [
|
|
'accesstoken',
|
|
'app-field',
|
|
'app-setting',
|
|
'app',
|
|
'client-trusted-domain',
|
|
'client',
|
|
'permission',
|
|
'post',
|
|
'refreshtoken',
|
|
'role',
|
|
'settings',
|
|
'session',
|
|
'subscriber',
|
|
'tag',
|
|
'user',
|
|
'invite',
|
|
'webhook',
|
|
'integration',
|
|
'api-key'
|
|
];
|
|
|
|
function init() {
|
|
exports.Base = require('./base');
|
|
|
|
models.forEach(function (name) {
|
|
_.extend(exports, require('./' + name));
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Expose `init`
|
|
*/
|
|
|
|
exports.init = init;
|