Authorship
This commit is contained in:
parent
e2aa298a8f
commit
8afce44a5e
7 changed files with 65 additions and 21 deletions
|
@ -11,7 +11,7 @@ export default Ability.extend({
|
|||
canEdit: function() {
|
||||
let role = this.get('session.currentUser.role');
|
||||
let id = this.get('session.currentUser.id');
|
||||
let author = this.get('model.author');
|
||||
let author = this.get('model.createdBy');
|
||||
return (role === 'W' && (+id === author)) || (role === 'A');
|
||||
}.property('session.currentUser.role', 'session.currentUser.id', 'model.author')
|
||||
}.property('session.currentUser.role', 'session.currentUser.id', 'model.createdBy')
|
||||
});
|
||||
|
|
|
@ -7,5 +7,8 @@ export default DS.Model.extend({
|
|||
measurements: DS.hasMany('measurements'),
|
||||
createdAt: DS.attr('date'),
|
||||
updatedAt: DS.attr('date'),
|
||||
deletedAt: DS.attr('date')
|
||||
deletedAt: DS.attr('date'),
|
||||
createdBy: DS.attr('number'),
|
||||
updatedBy: DS.attr('number'),
|
||||
deletedBy: DS.attr('number')
|
||||
});
|
||||
|
|
|
@ -13,6 +13,8 @@ export default DS.Model.extend({
|
|||
testMethod: DS.attr('string'),
|
||||
createdAt: DS.attr('date'),
|
||||
updatedAt: DS.attr('date'),
|
||||
createdBy: DS.attr('number'),
|
||||
updatedBy: DS.attr('number'),
|
||||
computedType: Ember.computed('textMeasurementType', 'txtValue', 'numValue', function() {
|
||||
if (this.get('textMeasurementType') && !this.get('txtValue') && !this.get('numValue')) {
|
||||
return 'Fixed-text';
|
||||
|
|
|
@ -13,7 +13,9 @@ export default DS.Model.extend({
|
|||
createdAt: DS.attr('date'),
|
||||
updatedAt: DS.attr('date'),
|
||||
deletedAt: DS.attr('date'),
|
||||
author: DS.attr('number'),
|
||||
createdBy: DS.attr('number'),
|
||||
updatedBy: DS.attr('number'),
|
||||
deletedBy: DS.attr('number'),
|
||||
totalMeasurements: DS.attr('number'),
|
||||
fullName: Ember.computed('speciesName', 'strainName', function() {
|
||||
return this.get('speciesName') + ' (' + this.get('strainName') + ')';
|
||||
|
|
|
@ -11,7 +11,10 @@ module.exports = function(app) {
|
|||
measurements: [1],
|
||||
createdAt: "0001-01-01T00:00:00Z",
|
||||
updatedAt: "0001-01-01T00:00:00Z",
|
||||
deletedAt: null
|
||||
deletedAt: null,
|
||||
createdBy: 1,
|
||||
updatedBy: 1,
|
||||
deletedBy: null
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
|
@ -21,7 +24,10 @@ module.exports = function(app) {
|
|||
measurements: [2],
|
||||
createdAt: "0001-01-01T00:00:00Z",
|
||||
updatedAt: "0001-01-01T00:00:00Z",
|
||||
deletedAt: null
|
||||
deletedAt: null,
|
||||
createdBy: 1,
|
||||
updatedBy: 1,
|
||||
deletedBy: null
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
|
@ -31,7 +37,10 @@ module.exports = function(app) {
|
|||
measurements: [3],
|
||||
createdAt: "0001-01-01T00:00:00Z",
|
||||
updatedAt: "0001-01-01T00:00:00Z",
|
||||
deletedAt: null
|
||||
deletedAt: null,
|
||||
createdBy: 1,
|
||||
updatedBy: 1,
|
||||
deletedBy: null
|
||||
}
|
||||
]
|
||||
|
||||
|
|
|
@ -15,7 +15,9 @@ module.exports = function(app) {
|
|||
notes: null,
|
||||
testMethod: null,
|
||||
createdAt: "0001-01-01T00:00:00Z",
|
||||
updatedAt: "0001-01-01T00:00:00Z"
|
||||
updatedAt: "0001-01-01T00:00:00Z",
|
||||
createdBy: 1,
|
||||
updatedBy: 1
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
|
@ -29,7 +31,9 @@ module.exports = function(app) {
|
|||
notes: null,
|
||||
testMethod: null,
|
||||
createdAt: "0001-01-01T00:00:00Z",
|
||||
updatedAt: "0001-01-01T00:00:00Z"
|
||||
updatedAt: "0001-01-01T00:00:00Z",
|
||||
createdBy: 1,
|
||||
updatedBy: 1
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
|
@ -43,7 +47,9 @@ module.exports = function(app) {
|
|||
notes: "some notes",
|
||||
testMethod: null,
|
||||
createdAt: "0001-01-01T00:00:00Z",
|
||||
updatedAt: "0001-01-01T00:00:00Z"
|
||||
updatedAt: "0001-01-01T00:00:00Z",
|
||||
createdBy: 1,
|
||||
updatedBy: 1
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
|
@ -57,7 +63,9 @@ module.exports = function(app) {
|
|||
notes: null,
|
||||
testMethod: null,
|
||||
createdAt: "0001-01-01T00:00:00Z",
|
||||
updatedAt: "0001-01-01T00:00:00Z"
|
||||
updatedAt: "0001-01-01T00:00:00Z",
|
||||
createdBy: 1,
|
||||
updatedBy: 1
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
|
@ -71,7 +79,9 @@ module.exports = function(app) {
|
|||
notes: null,
|
||||
testMethod: null,
|
||||
createdAt: "0001-01-01T00:00:00Z",
|
||||
updatedAt: "0001-01-01T00:00:00Z"
|
||||
updatedAt: "0001-01-01T00:00:00Z",
|
||||
createdBy: 1,
|
||||
updatedBy: 1
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
|
@ -85,7 +95,9 @@ module.exports = function(app) {
|
|||
notes: null,
|
||||
testMethod: null,
|
||||
createdAt: "0001-01-01T00:00:00Z",
|
||||
updatedAt: "0001-01-01T00:00:00Z"
|
||||
updatedAt: "0001-01-01T00:00:00Z",
|
||||
createdBy: 1,
|
||||
updatedBy: 1
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
|
@ -99,7 +111,9 @@ module.exports = function(app) {
|
|||
notes: null,
|
||||
testMethod: null,
|
||||
createdAt: "0001-01-01T00:00:00Z",
|
||||
updatedAt: "0001-01-01T00:00:00Z"
|
||||
updatedAt: "0001-01-01T00:00:00Z",
|
||||
createdBy: 1,
|
||||
updatedBy: 1
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
|
@ -113,7 +127,9 @@ module.exports = function(app) {
|
|||
notes: "some notes",
|
||||
testMethod: null,
|
||||
createdAt: "0001-01-01T00:00:00Z",
|
||||
updatedAt: "0001-01-01T00:00:00Z"
|
||||
updatedAt: "0001-01-01T00:00:00Z",
|
||||
createdBy: 1,
|
||||
updatedBy: 1
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
|
@ -127,7 +143,9 @@ module.exports = function(app) {
|
|||
notes: null,
|
||||
testMethod: null,
|
||||
createdAt: "0001-01-01T00:00:00Z",
|
||||
updatedAt: "0001-01-01T00:00:00Z"
|
||||
updatedAt: "0001-01-01T00:00:00Z",
|
||||
createdBy: 1,
|
||||
updatedBy: 1
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
|
@ -141,7 +159,9 @@ module.exports = function(app) {
|
|||
notes: null,
|
||||
testMethod: null,
|
||||
createdAt: "0001-01-01T00:00:00Z",
|
||||
updatedAt: "0001-01-01T00:00:00Z"
|
||||
updatedAt: "0001-01-01T00:00:00Z",
|
||||
createdBy: 1,
|
||||
updatedBy: 1
|
||||
}
|
||||
]
|
||||
|
||||
|
|
|
@ -15,7 +15,9 @@ module.exports = function(app) {
|
|||
createdAt: "0001-01-01T00:00:00Z",
|
||||
updatedAt: "0001-01-01T00:00:00Z",
|
||||
deletedAt: null,
|
||||
author: 1,
|
||||
createdBy: 1,
|
||||
updatedBy: 1,
|
||||
deletedBy: null,
|
||||
totalMeasurements: 5,
|
||||
notes: "Test notes",
|
||||
},
|
||||
|
@ -31,7 +33,9 @@ module.exports = function(app) {
|
|||
createdAt: "0001-01-01T00:00:00Z",
|
||||
updatedAt: "0001-01-01T00:00:00Z",
|
||||
deletedAt: null,
|
||||
author: 3,
|
||||
createdBy: 3,
|
||||
updatedBy: 3,
|
||||
deletedBy: null,
|
||||
totalMeasurements: 5,
|
||||
notes: "Test notes",
|
||||
},
|
||||
|
@ -47,7 +51,9 @@ module.exports = function(app) {
|
|||
createdAt: "0001-01-01T00:00:00Z",
|
||||
updatedAt: "0001-01-01T00:00:00Z",
|
||||
deletedAt: null,
|
||||
author: 1,
|
||||
createdBy: 1,
|
||||
updatedBy: 1,
|
||||
deletedBy: null,
|
||||
totalMeasurements: 0,
|
||||
notes: "Test notes",
|
||||
},
|
||||
|
@ -63,7 +69,9 @@ module.exports = function(app) {
|
|||
createdAt: "0001-01-01T00:00:00Z",
|
||||
updatedAt: "0001-01-01T00:00:00Z",
|
||||
deletedAt: null,
|
||||
author: 3,
|
||||
createdBy: 3,
|
||||
updatedBy: 3,
|
||||
deletedBy: null,
|
||||
totalMeasurements: 0,
|
||||
notes: "Test notes",
|
||||
}
|
||||
|
|
Reference in a new issue