def user(user): """Get ldap info for a single user by username.""" results = search(exact=True, uid=user) if results: return jsonify(results[0]) else: return 'User not found', 404
def ugkthid(ugkthid): """Get ldap info for a single user by ugKthid.""" results = search(exact=True, ugKthid=ugkthid) if results: return jsonify(results[0]) else: return 'User not found', 404
def users(query): """Perform an ldap search for multiple users.""" return jsonify(results=sorted(search(cn=query, uid=query), key=get_prio(query)))