Cybersecurity
DevOps Cloud (ADM)
IT Operations Cloud
Worked great...but…
Enabling Technologies
/** enable XML support **/
function createXMLHttpRequest() {
try { return new XMLHttpRequest(); } catch(e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
form.alert("XMLHttpRequest not supported by this browser");
return null;
}
xmlhttp = createXMLHttpRequest();
function xmlParse(XML)
{
var oParser = new DOMParser();
var oDOM = oParser.parseFromString(XML, "text/xml");
return oDOM;
}
function xmlSetText(DOM, elementName, value, dex)
{
if (undef(dex)) dex = 0;
var LMent = DOM.getElementsByTagName(elementName)[dex]
var textNode = xmlGetTextNode(LMent)
if (undef(textNode))
{
textNode = DOM.createTextNode(value),
LMent.appendChild(textNode);
}
else
textNode.nodeValue = value;
}
function xmlSetAttribute(DOM, elementName, attributeName, value, dex)
{
if (undef(dex)) dex = 0;
var attrNode = DOM.getElementsByTagName(elementName)[dex].getAttributeNode(attributeName);
attrNode.nodeValue = value;
}
function xmlGetText(elem)
{
var textNode = xmlGetTextNode(elem);
if (textNode)
{
return textNode.nodeValue;
}
else
{
return "";
}
}
function xmlGetTextNode(elem) {
// NOT GENERIC. assumes only child node within the element is the text node
return elem.firstChild;
}
function xmlSerialize(DOM)
{
return new XMLSerializer().serializeToString(DOM);
}
function getXMLResponse(form,field,xmlhttp,url,domRequest,callbackFunction)
{
txtRequest = xmlSerialize(domRequest);
xmlhttp.open("POST",url,true);
xmlhttp.withCredentials = true;
xmlhttp.setRequestHeader("Content-type", "text/xml");
xmlhttp.send(txtRequest);
xmlhttp.onreadystatechange= callbackFunction;
}
function xmlGetAttribute(elem, attributeName)
{
if (elem.hasAttribute(attributeName))
return elem.getAttribute(attributeName)
else
return "";
}
function xmlGetTextByAttribute(DOM, elementName, attributeName, value)
{
var textNodes = DOM.getElementsByTagName(elementName)
for (var i = 0; i < textNodes.length; i )
{
var attrNode = textNodes[i].getAttributeNode(attributeName);
if (attrNode.nodeValue == value)
{
return textNodes[i].childNodes[0]
}
}
return "";
}
function queryDoc()
{
var Q='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.novell.com/vdx/service">'
Q ='<soapenv:Header/>'
Q =' <soapenv:Body>'
Q =' <ser:queryRequest>'
Q =' <ser:arg0></ser:arg0>'
Q =' <ser:arg1></ser:arg1>'
Q =' <ser:arg2></ser:arg2>'
Q =' </ser:queryRequest>'
Q =' </soapenv:Body>'
Q ='</soapenv:Envelope>'
return Q;
}
/* adds a button to a field. When clicked the button publishes an event named "onclick-fieldname-buttonname" */
function addButton(field,name,label,fieldName)
{
if (undef(fieldName))
fieldName = field.getName();
var ctrl = JUICE.UICtrlUtil.getControl(field.getName());
var btn = JUICE.UICtrlUtil.addButton(ctrl, name , label, name, function() {field.fireEvent("onclick-" fieldName "-" name,field.getName())});
}
/* field ADVSRCH_mode_advanced */
addButton(field,"search","Search")
getXMLResponse(form,field,xmlhttp,"/IDMProv/vdx/service",domRequest, OnStateChange);
function OnStateChange() {
if (xmlhttp.readyState==4) {
field.fireEvent("onreceive-ADVSRCH_mode_advanced",xmlhttp.responseText)
}
}
function vdxQuery(entityKey, queryString)
{
ATTRS = ["LastName", "FirstName", "CN", "ACMELastSSN","workforceID","L", "employeeStatus","PasswordExpirationTime","LockedByIntruder","ACMEAuthLockout", "Email","manager"]
var domRequest = xmlParse(queryDoc());
xmlSetText(domRequest, "ser:arg0", entityKey)
xmlSetText(domRequest, "ser:arg2", queryString)
ATTRS = ["LastName", "FirstName", "CN", "ACMELastSSN","workforceID","L", "employeeStatus","PasswordExpirationTime","LockedByIntruder","ACMEAuthLockout", "Email","manager"]
var serArg1 = domRequest.getElementsByTagName("ser:arg1")[0];
for (var i = 0; i < ATTRS.length; i )
{
var serStringText = domRequest.createTextNode(ATTRS[i]);
var serString = domRequest.createElement("ser:string");
serString.appendChild(serStringText);
serArg1.appendChild(serString);
}
getXMLResponse(form,field,xmlhttp,"/IDMProv/vdx/service",domRequest, OnStateChange);
}
|
<myElem myAttribute="value">text</myElem> |
|
<myElem myAttribute="value">text</myElem> |
|
<myElem myAttribute="value">text</myElem> |
Finally, on to the VDX
The VDX Query Language
> , < , >= , <= , = , != , !< , !> , !<= , !>= , STARTWITH, !STARTWITH, IN , !IN , PRESENT, !PRESENT
((FirstName STARTWITH 'J') AND (LastName = 'Smith')) OR (CN IN 'guest')
The SOAP Request for the VDX query
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.novell.com/vdx/service">
<soapenv:Header/>
<soapenv:Body>
<ser:queryRequest>
<!--Optional:-->
<ser:arg0>user</ser:arg0>
<!--Optional:-->
<ser:arg1>
<!--Zero or more repetitions:-->
<ser:string>manager</ser:string>
<ser:string>PasswordExpirationTime</ser:string>
<ser:string>LastName</ser:string>
<ser:string>FirstName</ser:string>
</ser:arg1>
<!--Optional:-->
<ser:arg2>(FirstName STARTWITH 'M') AND (LastName STARTWITH 'C') </ser:arg2>
</ser:queryRequest>
</soapenv:Body>
</soapenv:Envelope
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:queryResponse xmlns="http://www.novell.com/vdx/service" xmlns:ns1="http://www.novell.com/vdx/service">
<result>
<entries>
<entry>
<key>cn=fcgd4675,ou=users,o=acme</key>
<values>
<attribute>
<binaries/>
<booleans/>
<dates/>
<integers/>
<strings>
<string>cn=blyc3668,ou=users,o=acme</string>
</strings>
<type>DN</type>
</attribute>
<attribute>
<binaries/>
<booleans/>
<dates>
<datetime>2016-09-09T15:10:36</datetime>
</dates>
<integers/>
<strings/>
<type>Time</type>
</attribute>
<attribute>
<binaries/>
<booleans/>
<dates/>
<integers/>
<strings>
<string>Cencer</string>
</strings>
<type>String</type>
</attribute>
<attribute>
<binaries/>
<booleans/>
<dates/>
<integers/>
<strings>
<string>Marla</string>
</strings>
<type>String</type>
</attribute>
</values>
</entry>
<entry>
<key>cn=dhgb2806,ou=users,o=acme</key>
<values>
<attribute xsi:nil="1"/>
<attribute>
<binaries/>
<booleans/>
<dates>
<datetime>2016-09-09T14:42:17</datetime>
</dates>
<integers/>
<strings/>
<type>Time</type>
</attribute>
<attribute>
<binaries/>
<booleans/>
<dates/>
<integers/>
<strings>
<string>Castro</string>
</strings>
<type>String</type>
</attribute>
<attribute>
<binaries/>
<booleans/>
<dates/>
<integers/>
<strings>
<string>Marcos</string>
</strings>
<type>String</type>
</attribute>
</values>
</entry>
</entries>
</result>
</ns1:queryResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
No objects returned |
Display a "not found" dialog |
One object returned |
Select that item and populate the form |
Multiple objects returned |
Fire an event to signal an HTML control to render the array as a table |