Correctly handle the boolean grantable flag in the user permission
editor. In some cases, the boolean 0/1 values returned from storage are
returned as strings. Cast them to numbers before checking truthiness.
Signed-off-by: Bill Erickson <berickxx@gmail.com>
var dis = false;
- if ((up && up.id() < 0) || !sp || !sp.grantable()) dis = true;
+ if ((up && up.id() < 0) || !sp || !Number(sp.grantable())) dis = true;
if (all) dis = false;
var label_cell = findNodeByName(prow,'plabel');
var grant_cell = findNodeByName(prow,'pgrant');
findNodeByName(grant_cell,'p.grantable').disabled = dis;
- findNodeByName(grant_cell,'p.grantable').checked = up ? (up.grantable() ? true : false) : false;
+ findNodeByName(grant_cell,'p.grantable').checked =
+ up ? (Number(up.grantable()) ? true : false) : false;
+
if (r % 2) grant_cell.className += ' odd';
}