2018-06-19 18:48:14 -04:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const _ = require('underscore');
|
|
|
|
const Backbone = require('backbone');
|
|
|
|
|
|
|
|
const model = Backbone.Model.extend({
|
|
|
|
idAttribute: 'id',
|
|
|
|
|
|
|
|
defaults: function () {
|
|
|
|
return {
|
|
|
|
name: '',
|
|
|
|
nickname: '',
|
|
|
|
email: '',
|
|
|
|
is_disabled: false,
|
2018-07-04 18:27:25 -04:00
|
|
|
roles: [],
|
|
|
|
permissions: null
|
2018-06-19 18:48:14 -04:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
isAdmin: function () {
|
|
|
|
return _.indexOf(this.get('roles'), 'admin') !== -1;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
Model: model,
|
|
|
|
Collection: Backbone.Collection.extend({
|
|
|
|
model: model
|
|
|
|
})
|
|
|
|
};
|