Difference between revisions of "Flow/Scripting/LDAPAccess"

From Observer GigaFlow Support | VIAVI Solutions Inc.
Jump to: navigation, search
(Created page with "//Querying LDAP. //Query for distinguishedName and displayName attributes for objects of objectClass=user var results = actions.getLDAP("distinguishedName,displayName","(&(...")
 
 
Line 2: Line 2:
 
  //Query for distinguishedName and displayName attributes for objects of objectClass=user
 
  //Query for distinguishedName and displayName attributes for objects of objectClass=user
 
  var results = actions.getLDAP("distinguishedName,displayName","(&(objectClass=user))")
 
  var results = actions.getLDAP("distinguishedName,displayName","(&(objectClass=user))")
  if (results!=null){
+
  if (results!=null){ //Make sure there are results
     for (var i=0;i<results.size();i++){
+
     for (var i=0;i<results.size();i++){ //Iterate over each result
         var attributes = results.get(i);
+
         var attributes = results.get(i); //Get this results attributes
         if (attributes){
+
         if (attributes){ //Make sure they exists
 
             var attributeDistinguishedName =attributes.get('distinguishedName');
 
             var attributeDistinguishedName =attributes.get('distinguishedName');
 
             var attributeDisplayName =attributes.get('displayName');
 
             var attributeDisplayName =attributes.get('displayName');

Latest revision as of 11:27, 23 January 2017

//Querying LDAP.

//Query for distinguishedName and displayName attributes for objects of objectClass=user
var results = actions.getLDAP("distinguishedName,displayName","(&(objectClass=user))")
if (results!=null){ //Make sure there are results
    for (var i=0;i<results.size();i++){ //Iterate over each result
        var attributes = results.get(i); //Get this results attributes
        if (attributes){ //Make sure they exists
            var attributeDistinguishedName =attributes.get('distinguishedName');
            var attributeDisplayName =attributes.get('displayName');
            if (attributeDistinguishedName ){
            log.warn(attributeDistinguishedName.getID()+' '+attributeDistinguishedName.get());
            }
            if (attributeDisplayName ){
                log.warn(attributeDisplayName.getID()+' '+attributeDisplayName.get());
            }
        }
    }
}else{
    log.warn("No results");
}