Ghost/core/server/models/permission.js

29 lines
597 B
JavaScript
Raw Normal View History

var ghostBookshelf = require('./base'),
User = require('./user').User,
Role = require('./role').Role,
validation = require('../data/validation'),
Permission,
Permissions;
Permission = ghostBookshelf.Model.extend({
tableName: 'permissions',
roles: function () {
return this.belongsToMany(Role);
},
users: function () {
return this.belongsToMany(User);
}
});
Permissions = ghostBookshelf.Collection.extend({
model: Permission
});
module.exports = {
Permission: Permission,
Permissions: Permissions
};