_oho Posted November 30, 2013 Share Posted November 30, 2013 (edited) Hello, Here is a quick workflow that search over an ldap directory. Query string is passed to a python script that request ldap and parse result. Result is displayed as a list and action to an item does actually call DeskConnect. But you could easily customise with your preferred action like call SIP or send email, etc. This workflow came after discussion on ldap topic here. Great support from community (in particular David and Shawn). Dependencies: Python 2.5. (probably compatible with all python 2.x); DeskConnect (optional) Configuration: within Python script (ldap address + some few params - see Github Readme). Download: LDAP.alfredworkflow on GitHub Feel free to suggest improvements (or improve by yourself of course). Any feedbacks also welcome. Thank you! Olivier. Edited November 30, 2013 by _oho Link to comment
chrishumphr1es Posted February 17, 2014 Share Posted February 17, 2014 Hi Olivier, Very excited for this workflow. My only confusion is what parameters I need to change on the python script. I am familiar with python to a certain degree, but still need guidance navigating it every now and then. Could you provide the parts of the script that I need to replace with my own company's ldap info? Thanks! Link to comment
_oho Posted February 18, 2014 Author Share Posted February 18, 2014 Hello Chris, I don't know if you have already solved your problem? Sorry for late reply, I'm on vacation and as commonly stated, "with limited email access" Looking at the python script, what you probably want to set first is your ldap host. So first line to change is line 4: LDAP_HOST="". In my cas it's something like LDAP_HOST="ldap://myCompanyInterlaHost.internalDomain" Next step is to find out the options (in red) to set in line 24. ldap_result=Popen(["ldapsearch", "-S", "displayName", "-x", "-b", "dc=localInfoToChange,dc=fr", "-H", LDAP_HOST, "-LLL", "(displayName="+KEYWORD+"*)", "telephoneNumber", "mail", "uid", "displayName], stdout=PIPE, stderr=devnull).communicate()[0] Note: blue strings are the fields I'm querying at while running ldapsearch command. Finally, I'm doing some parsing of returned text from ldapsearch command. In my case, I'm looking to extract "telephoneNumber", "displayName", "uid", and "mail". In a loop while I find results I write to a file the content, correctly formatted for Alfted listing info. Sorry, as I'm not at the office, I cannot show what looks like the result of ldapsearch. What I would suggest is to start by identifying your ldap server url then play around with ldapsearch command line from within terminal and see if you can get some results based on your search. The rest will be playing with parsing your own results. Good luck. O. Link to comment
chrishumphr1es Posted February 18, 2014 Share Posted February 18, 2014 Thanks so much! So here's where I am at: I've gotten ldapsearch to work, but I can only get it to return based on uid. Whenever I do this in the alfred workflow, I always get "contact list result" returned. any idea why? Link to comment
_oho Posted February 19, 2014 Author Share Posted February 19, 2014 "contact list result" is the keyword used to call newt script filter that just do in bash: cat << INFO `more /tmp/ldap-result.xml` INFO Meaning that your /tmp/ldap-result.xml should not exist or be not well formed. Try to see if you have a /tmp/ldap-result.xml. Also, my parsing is expected a specific type of info from your ldapsearch result. if the result is different, it will not work. O. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now