2013-09-23 02:20:08 +04:00
|
|
|
var ghostBookshelf = require('./base'),
|
2013-09-24 14:46:30 +04:00
|
|
|
User = require('./user').User,
|
|
|
|
Role = require('./role').Role,
|
2014-02-19 21:32:23 +04:00
|
|
|
validation = require('../data/validation'),
|
2014-02-19 17:57:26 +04:00
|
|
|
|
2013-06-25 15:43:15 +04:00
|
|
|
Permission,
|
|
|
|
Permissions;
|
2013-06-05 07:47:11 +04:00
|
|
|
|
2013-09-23 02:20:08 +04:00
|
|
|
Permission = ghostBookshelf.Model.extend({
|
2013-09-14 23:01:46 +04:00
|
|
|
|
2013-06-25 15:43:15 +04:00
|
|
|
tableName: 'permissions',
|
2013-06-05 07:47:11 +04:00
|
|
|
|
2013-06-25 15:43:15 +04:00
|
|
|
roles: function () {
|
|
|
|
return this.belongsToMany(Role);
|
|
|
|
},
|
2013-06-05 07:47:11 +04:00
|
|
|
|
2013-06-25 15:43:15 +04:00
|
|
|
users: function () {
|
|
|
|
return this.belongsToMany(User);
|
|
|
|
}
|
|
|
|
});
|
2013-06-05 07:47:11 +04:00
|
|
|
|
2013-09-23 02:20:08 +04:00
|
|
|
Permissions = ghostBookshelf.Collection.extend({
|
2013-06-25 15:43:15 +04:00
|
|
|
model: Permission
|
|
|
|
});
|
2013-06-05 07:47:11 +04:00
|
|
|
|
2013-06-25 15:43:15 +04:00
|
|
|
module.exports = {
|
|
|
|
Permission: Permission,
|
|
|
|
Permissions: Permissions
|
|
|
|
};
|