c0dc8e95d2
closes #2325 - added new permissions - added relation to user roles - added updateFixtures to migrateUp - removed validation per model to fix tests
34 lines
661 B
JavaScript
34 lines
661 B
JavaScript
var ghostBookshelf = require('./base'),
|
|
User = require('./user').User,
|
|
Role = require('./role').Role,
|
|
App = require('./app').App,
|
|
|
|
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: Permission,
|
|
Permissions: Permissions
|
|
};
|