Cybersecurity
DevOps Cloud
IT Operations Cloud
editable = new Array();
viewable = new Array();
supervisory = new Array();
editableOOB = new Array();
viewableOOB = new Array();
function publishEvent(field,event)
{
/* republishes an event so other fields can use
it in the format eventname-fieldname */
if (!undef(field.getValue()))
{
field.fireEvent(event.getEventName() "-" field.getName(),field.getValue())
}
}
function fill(IDVault,event,field,applyAllAttributeRights)
{
// applyAllAttributeRights defaults to true if not supplied in the call
if (undef(applyAllAttributeRights)) applyAllAttributeRights=true;
// get the value from the vault for this field
var value= IDVault.get(null, event.getCustomData().toString(), "user", field.getName());
// should this field be made invisible or disabled?
visinabled(field, applyAllAttributeRights);
// if no value is returned from the vault, clear the field.
if (!undef(value))
{
field.setValues(value.toString())
}
else
{
field.setValues([""])
}
}
function visinabled(field, applyAllAttributeRights)
{
// applyAllAttributeRights defaults to true if not supplied in the call
if (undef(applyAllAttributeRights)) applyAllAttributeRights=true;
var isEditable = ok2Enable(field.getName(), applyAllAttributeRights);
var isVisible = ok2Show(field.getName(), applyAllAttributeRights);
visible=" isVisible.toString());
// for sensitive fields where [All Attribute Rights] should not apply make invisible
// if the field is not editable.
visible(field, isVisible);
if (!isEditable && !applyAllAttributeRights)
{
// dbg("Not editable and not applying all attribute rights forcing disabled");
enabled(field,false);
return false;
}
else
{
enabled(field, isEditable);
// dbg("enabled()");
return true;
}
}
function ok2Enable(fieldName, applyAllAttributeRights)
{
//default respect all attribute rights to yes
if (undef(applyAllAttributeRights)) applyAllAttributeRights=true;
if (applyAllAttributeRights && thisEditable().indexOf("[All Attributes Rights]") != -1)
{
return true;
}
else
{
var dex = xlate[0].indexOf(fieldName);
if (dex != -1) fieldName = xlate[1][dex];
return (thisEditable().indexOf(fieldName) != -1);
}
}
function ok2Show(fieldName, applyAllAttributeRights)
{
//default respect all attribute rights to yes
if (undef(applyAllAttributeRights)) applyAllAttributeRights=true;
if (applyAllAttributeRights && thisViewable().indexOf("[All Attributes Rights]") != -1)
{
return true;
}
else
{
//translate attributename to field name
var dex = xlate[0].indexOf(fieldName);
if (dex != -1) fieldName = xlate[1][dex];
return (thisViewable().indexOf(fieldName) != -1);
}
}
Remember how the target user might affect whether we want to enable or disable the user (whether or not they are HR Managed)? This is all handled here inside the call to the ok2xxxx() functions. In order to provide a simple mechanism to allow these two configurations to be bolted into my original design, these functions present the proper list depending on the status of the HRManaged flag
function OOB()
{
return !toBoolean(Form.getValue("XXHRmanaged"));
}
function toBoolean(strng)
{
if (undef(strng))
return false
else
return (strng.toString().toLowerCase() == "true");
}
function thisEditable()
{
if (OOB())
{
return editableOOB;
}
else
{
return editable;
}
}
function thisViewable()
{
if (OOB())
{
return viewableOOB;
}
else
{
return viewable;
}
}
1 Generational Qualifier is intended to be the generation specified after a name, Jr., Sr., III, IV, etc.99