Ghost/core/shared/models/role.js
Jacob Gable e6f7c706cb Permissions / ACL
- Created Role model
- Created Permission model
- Linked Users->Roles with a belongsToMany relationship
- Linked Permissions to Users and Roles with a belongsToMany relationship
- Created permissions helper with functions for initializing and
  checking permissions (canThis)
- Unit tests for lots of things
2013-06-06 08:15:10 +01:00

32 lines
619 B
JavaScript

(function () {
"use strict";
var User = require('./user').User,
Permission = require('./permission').Permission,
GhostBookshelf = require('./base'),
Role,
Roles;
Role = GhostBookshelf.Model.extend({
tableName: 'roles',
users: function () {
return this.belongsToMany(User);
},
permissions: function () {
return this.belongsToMany(Permission);
}
});
Roles = GhostBookshelf.Collection.extend({
model: Role
});
module.exports = {
Role: Role,
Roles: Roles
};
}());