24 lines
663 B
JavaScript
24 lines
663 B
JavaScript
module.exports = Self => {
|
|
require('../methods/state/editableStates')(Self);
|
|
|
|
/**
|
|
* Checks if the alertLevel of a state is 0.
|
|
*
|
|
* @param {Integer} stateId The user id
|
|
* @return {Boolean} %true if user has the role, %false otherwise
|
|
*/
|
|
Self.isAlertLevelZero = async function(stateId) {
|
|
let result = await Self.rawSql(
|
|
`SELECT alertLevel
|
|
FROM vn.state
|
|
WHERE id = ?`,
|
|
[stateId]
|
|
);
|
|
return result[0].alertLevel == 0;
|
|
};
|
|
|
|
Self.prototype.isEditable = function() {
|
|
return this.code == 'PICKER_DESIGNED' || this.alertLevel == 0;
|
|
};
|
|
};
|