src/models/user/AllowedAction.js
/**
* Model representing a Role AllowedAction. AllowedAction persists the access symbol of the Permission (e.g. read, manage).
*/
class AllowedActionModel {
/**
* @param {Object} response - JSON formatted response of a user role.
* @param {Number} response.id - The user role ID value
* @param {String} response.name - Name of the permitted action
*/
constructor(response = {}) {
const _response = response.data || response; // if json api is passed in directly
const attributes = _response.attributes || _response; // if json api is passed in directly
if (_response.id) {
/** @type {Number} */
this.id = parseInt(_response.id, 10);
}
/** @type {String} */
this.name = attributes.name;
}
}
export default AllowedActionModel;