This repository has been archived on 2025-03-30. You can view files and clone it, but cannot push or open issues or pull requests.
hymenobacterdotinfo/app/models/user.js
Matthew Dillon 007de178d8 Drop soft delete
Fixes #19.
2015-10-13 16:33:34 -07:00

28 lines
650 B
JavaScript

import DS from 'ember-data';
export default DS.Model.extend({
email : DS.attr('string'),
password : DS.attr('string'),
name : DS.attr('string'),
role : DS.attr('string'),
canEdit : DS.attr('boolean'),
createdAt: DS.attr('date'),
updatedAt: DS.attr('date'),
isAdmin: function() {
return this.get('role') === 'A';
}.property('role'),
fullRole: function() {
let role = this.get('role');
if (role === 'R') {
return 'Read-Only';
} else if (role === 'W') {
return 'Write';
} else if (role === 'A') {
return 'Admin';
} else {
return 'Error';
}
}.property('role'),
});