2013-09-22 18:20:08 -04:00
|
|
|
var ghostBookshelf = require('./base'),
|
2014-03-14 18:36:45 +01:00
|
|
|
|
2013-06-25 12:43:15 +01:00
|
|
|
Permission,
|
|
|
|
Permissions;
|
2013-06-04 22:47:11 -05:00
|
|
|
|
2013-09-22 18:20:08 -04:00
|
|
|
Permission = ghostBookshelf.Model.extend({
|
2013-09-14 20:01:46 +01:00
|
|
|
|
2013-06-25 12:43:15 +01:00
|
|
|
tableName: 'permissions',
|
2013-06-04 22:47:11 -05:00
|
|
|
|
2013-06-25 12:43:15 +01:00
|
|
|
roles: function () {
|
2014-07-13 12:17:18 +01:00
|
|
|
return this.belongsToMany('Role');
|
2013-06-25 12:43:15 +01:00
|
|
|
},
|
2013-06-04 22:47:11 -05:00
|
|
|
|
2013-06-25 12:43:15 +01:00
|
|
|
users: function () {
|
2014-07-13 12:17:18 +01:00
|
|
|
return this.belongsToMany('User');
|
2014-02-11 21:40:39 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
apps: function () {
|
2014-07-13 12:17:18 +01:00
|
|
|
return this.belongsToMany('App');
|
2013-06-25 12:43:15 +01:00
|
|
|
}
|
|
|
|
});
|
2013-06-04 22:47:11 -05:00
|
|
|
|
2013-09-22 18:20:08 -04:00
|
|
|
Permissions = ghostBookshelf.Collection.extend({
|
2013-06-25 12:43:15 +01:00
|
|
|
model: Permission
|
|
|
|
});
|
2013-06-04 22:47:11 -05:00
|
|
|
|
2013-06-25 12:43:15 +01:00
|
|
|
module.exports = {
|
2014-07-13 12:17:18 +01:00
|
|
|
Permission: ghostBookshelf.model('Permission', Permission),
|
|
|
|
Permissions: ghostBookshelf.collection('Permissions', Permissions)
|
2014-02-27 02:44:09 +00:00
|
|
|
};
|