2013-09-24 05:46:30 -05:00
|
|
|
var User = require('./user').User,
|
|
|
|
Permission = require('./permission').Permission,
|
2013-09-22 17:20:08 -05:00
|
|
|
ghostBookshelf = require('./base'),
|
2014-02-19 08:57:26 -05:00
|
|
|
|
2013-06-25 06:43:15 -05:00
|
|
|
Role,
|
|
|
|
Roles;
|
|
|
|
|
2013-09-22 17:20:08 -05:00
|
|
|
Role = ghostBookshelf.Model.extend({
|
2013-06-25 06:43:15 -05:00
|
|
|
|
2013-09-14 14:01:46 -05:00
|
|
|
tableName: 'roles',
|
2013-08-25 05:49:31 -05:00
|
|
|
|
2013-06-25 06:43:15 -05:00
|
|
|
users: function () {
|
|
|
|
return this.belongsToMany(User);
|
|
|
|
},
|
|
|
|
|
|
|
|
permissions: function () {
|
|
|
|
return this.belongsToMany(Permission);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-09-22 17:20:08 -05:00
|
|
|
Roles = ghostBookshelf.Collection.extend({
|
2013-06-25 06:43:15 -05:00
|
|
|
model: Role
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
Role: Role,
|
|
|
|
Roles: Roles
|
|
|
|
};
|