21 lines
702 B
JavaScript
21 lines
702 B
JavaScript
/**
|
|
* Model representing an entity (user, group, etc.) that may share a Visualization.
|
|
* Actual model is wrapped with additional metadata for the grantable context.
|
|
*/
|
|
cdb.admin.Grantable = cdb.core.Model.extend({
|
|
|
|
initialize: function() {
|
|
this.entity = this._createEntity();
|
|
},
|
|
|
|
// @return {Object} instance of the real model this grantable entitity represents
|
|
// Keep in mind that this returns a new instance of that model (i.e. not a cache version)
|
|
_createEntity: function() {
|
|
var className = cdb.Utils.capitalize(this.get('type'));
|
|
var model = new cdb.admin[className](this.get('model'));
|
|
model.organization = this.collection.organization;
|
|
return model;
|
|
}
|
|
|
|
});
|