Ghost/core/server/models/permission.js
Hannah Wolfe 6e48275160 Extending context concept to models
fixes #3275, fixes #3290, ref #3086, ref #3084

- Ensure that we use the current logged in user and not just user 1 when
- removing hard coded user: 1 except where absolutely necessary
- passing context, rather than user to models
- base model has a new function to determine what id to use for created_by etc
2014-07-18 15:32:56 +01:00

31 lines
612 B
JavaScript

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