Flow/Scripting/LDAPAccess

From Observer GigaFlow Support | VIAVI Solutions Inc.
Jump to: navigation, search

//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");
}