mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 07:09:48 +03:00
6e48275160
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
31 lines
612 B
JavaScript
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)
|
|
};
|