House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Search cf-talk

July 04, 2009

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Home /  Groups /  ColdFusion Talk (CF-Talk)

LDAP Anyone?

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Thanks Michael,
Vince Collins (NHJobs.com)
03/22/07 05:14 P
Thanks again Michael,
Vince Collins (NHJobs.com)
03/22/07 06:43 P
On a totally different note:
Dinner
03/22/07 07:43 P
Thanks Dinner,
Vince Collins (NHJobs.com)
03/23/07 08:46 A
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Vince Collins (NHJobs.com)
03/22/2007 04:54 PM

It appears from the lack of response on this mail list to my question that none of you have any idea.  I'm bummed and feel now I must look elsewhere besides ColdFusion to solve this problem. I will post this one last time in the hopes that someone will respond with an idea or suggestion: - - - - - - - - I have been asked to write a web-based editor to allow users to edit individual attributes themselves directly.  I have done this and it is working for text attributes however it is not working for images. I have written the code to upload and READASBINARY the file.  Then when putting the new file back into ldap I use jpegPhoto=#toBase64(BinaryImageContent)# which I was told that images for LDAP were stored in base64 (Let me know if I'm wrong) but it appears to not work for me.  Is there some sort of switch you pass to LDAP when your code is updating an image attribute to somehow flag it as a binary attribute? I've been looking for an answer and have posted questions on more then 20 forums and blogs over the past week.  You all may have detected that I am a bit frustrated and desperate  :( <cffile action="READBINARY" file="#root#\update\upload\#file.serverfile#" variable="BinaryImageContent"> <cfldap action="modify"           DN="#qry_get_one_emp.distinguishedName#"           attributes="jpegPhoto=#toBase64(BinaryImageContent)#"           modifytype="replace"           server="#LDAPServer#"           username="#LDAPUsername#"           password="#LDAPPassword#"> Changing this attributes="jpegPhoto=#toBase64(BinaryImageContent)#" to this attributes="jpegPhoto=#BinaryImageContent#" also errors since it appears that CFLDAP or http does not allow you to use binary directly in the call. - - - - - - - I'm at a loss and looking for any help possible.  I really don't want to tell my client that ColdFusion can not do this.  I'd much rather say that I didn't know how and the ColdFusion community were able to help me.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dawson, Michael
03/22/2007 05:00 PM

There are methods for storing binaries/images in a database field.  You could also convert the binary information to text, then store the text in a database. You could do something similar with LDAP.  Just create a new attribute that can hold a large text value.  Treat your LDAP server just like you would a database. M!ke It appears from the lack of response on this mail list to my question that none of you have any idea.  I'm bummed and feel now I must look elsewhere besides ColdFusion to solve this problem. I will post this one last time in the hopes that someone will respond with an idea or suggestion: - - - - - - - - I have been asked to write a web-based editor to allow users to edit individual attributes themselves directly.  I have done this and it is working for text attributes however it is not working for images. I have written the code to upload and READASBINARY the file.  Then when putting the new file back into ldap I use jpegPhoto=#toBase64(BinaryImageContent)# which I was told that images for LDAP were stored in base64 (Let me know if I'm wrong) but it appears to not work for me.  Is there some sort of switch you pass to LDAP when your code is updating an image attribute to somehow flag it as a binary attribute? I've been looking for an answer and have posted questions on more then 20 forums and blogs over the past week.  You all may have detected that I am a bit frustrated and desperate  :( <cffile action="READBINARY" file="#root#\update\upload\#file.serverfile#" variable="BinaryImageContent"> <cfldap action="modify"           DN="#qry_get_one_emp.distinguishedName#"           attributes="jpegPhoto=#toBase64(BinaryImageContent)#"           modifytype="replace"           server="#LDAPServer#"           username="#LDAPUsername#"           password="#LDAPPassword#"> Changing this attributes="jpegPhoto=#toBase64(BinaryImageContent)#" to this attributes="jpegPhoto=#BinaryImageContent#" also errors since it appears that CFLDAP or http does not allow you to use binary directly in the call. - - - - - - - I'm at a loss and looking for any help possible.  I really don't want to tell my client that ColdFusion can not do this.  I'd much rather say that I didn't know how and the ColdFusion community were able to help me.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Vince Collins (NHJobs.com)
03/22/2007 05:14 PM

Thanks Michael, I am treating it like a database and all is well except for images.   Text for example updates just fine.  The directory has thousands of users which means thousands of images.  Each image is stored in the directory as a "binary attribute".  I need to adhere to that field. Other tools use the existing images as they are stored currently (as binary).  I can update the images using for example http://www-unix.mcs.anl.gov/~gawor/ldap/ which is an excellent java-based editor.  It allows me to browse to my image and then it uploads it and all is well.  Stored as a binary.  However, if I change the way I store it because ColdFusion has to store it in a different way then all other tools such as that ldap browser/editor won't work and all the locations they are displaying it elsewhere would break. I'm hoping to find a way to update this existing binary attribute using CFLDAP or other tool. Dawson, Michael wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dawson, Michael
03/22/2007 05:20 PM

Ah. I gotcha now.  You don't want to break convention just for ColdFusion. I'm not sure how else I can help other than "part" of the functionality is there with the RETURNASBINARY attribute.  However, I know of no corresponding send-type attribute.  You should be able to get the image using ColdFusion, but no way to put an image into the directory. You might want to Google Damon Cooper and send him a message asking about this.  They might be able to add this as part of Scorpio. M!ke Thanks Michael, I am treating it like a database and all is well except for images.   Text for example updates just fine.  The directory has thousands of users which means thousands of images.  Each image is stored in the directory as a "binary attribute".  I need to adhere to that field. Other tools use the existing images as they are stored currently (as binary).  I can update the images using for example http://www-unix.mcs.anl.gov/~gawor/ldap/ which is an excellent java-based editor.  It allows me to browse to my image and then it uploads it and all is well.  Stored as a binary.  However, if I change the way I store it because ColdFusion has to store it in a different way then all other tools such as that ldap browser/editor won't work and all the locations they are displaying it elsewhere would break. I'm hoping to find a way to update this existing binary attribute using CFLDAP or other tool. Dawson, Michael wrote: > There are methods for storing binaries/images in a database field. You > could also convert the binary information to text, then store the text > in a database. > > You could do something similar with LDAP.  Just create a new attribute > that can hold a large text value.  Treat your LDAP server just like you ----- Excess quoted text cut - see Original Post for more ----- when > putting the new file back into ldap I use > jpegPhoto=#toBase64(BinaryImageContent)# which I was told that images > for LDAP were stored in base64 (Let me know if I'm wrong) but it appears > to not work for me.  Is there some sort of switch you pass to LDAP when > your code is updating an image attribute to somehow flag it as a binary > attribute? > > I've been looking for an answer and have posted questions on more then > 20 forums and blogs over the past week.  You all may have detected that ----- Excess quoted text cut - see Original Post for more ----- to > tell my client that ColdFusion can not do this.  I'd much rather say > that I didn't know how and the ColdFusion community were able to help > me.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Vince Collins (NHJobs.com)
03/22/2007 06:43 PM

Thanks again Michael, I guess that's the question.  Can ColdFusion do this now?  In 6.1 or 7.0?  I think it probably can but I don't know if there is some switch or other that can be passed along with this update that tells LDAP so. That's the question, can it be done now?  I guess it may be the case that I am the only person on planet ColdFusion that has tried to update an image using CFLDAP? UGH! I'll give Damon Cooper a shot.  Please folks, don't give up on me.  I'm hoping someone is on vacation and will read this when they get back and enlighten me :) Dawson, Michael wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dinner
03/22/2007 07:43 PM

On a totally different note: Why not use some java solution?  I bet you could even do something along the lines of cfmail, where CF has javamail (iirc), which totally rocks, but of which CF exposes only a tiny bit. Find what CF uses for LDAP, research it, and call it yourself using createObject(), if even just for the image upload stuff. Whenever I've run into a problem like that (IMAP stuff, in my case), I've found using the underlying java will do what CF couldn't, if in fact CF can't. HIH, and if you have questions about how to leverage some java package, feel free to ask.  Maybe jldap ( openldap.org)?  Eh... Force be with you! > > Thanks again Michael, > > I guess that's the question.  Can ColdFusion do this now?  In 6.1 or > 7.0?  I think it probably can but I don't know if there is some switch > or other that can be passed along with this update that tells LDAP so. > ...

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Leitch, Oblio
03/23/2007 07:38 AM

I second this.  Remember, because CF is "typeless", when it tries to write to output binary in the <cfldap> tage, it might be expecting a string, not binary.  How they've chosen to output the attributes, I don't know, but that might cause it to fail. I would double (triple?) check that the data sent through LDAP is, in fact, binary or encoded (base64 or hex or uuencode, etc).  I wouldn't use a tool to do that as it might be altering results.  Rather, try a packet sniffer to see what the actual contents are.  If it's encoded, your life will be easier.  If not, then you're probably going to have to investigate some Java-based alternative. My experience: I wanted a way to compress data. Specifically, I thought there should be a way to feed data through a CF function and get a compressed result.  Since there's nothing that does it natively, I turned to Java.  Java has a native GZipDataStream - very slick.  The trouble was getting the data from CF -- it could only come and go as a "String".  I ended up requiring it to be base64 encoded to and from, and decode it once it was inside Java.  (now I have a tag that will compress a datastream without writing to disk.  I use it for squashing wddx packets for storage in a database) I think it was the "interface" they've written for custom CFX that's the limiter. On a totally different note: Why not use some java solution?  I bet you could even do something along the lines of cfmail, where CF has javamail (iirc), which totally rocks, but of which CF exposes only a tiny bit. Find what CF uses for LDAP, research it, and call it yourself using createObject(), if even just for the image upload stuff. Whenever I've run into a problem like that (IMAP stuff, in my case), I've found using the underlying java will do what CF couldn't, if in fact CF can't. HIH, and if you have questions about how to leverage some java package, feel free to ask.  Maybe jldap ( openldap.org)?  Eh... Force be with you! This email message may contain privileged and/or confidential information. If you are not the intended recipient(s), you are hereby notified that any dissemination, distribution, or copying of this email message is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete this email message from your computer. CAUTION: The Agency of Human Services cannot ensure the confidentiality or security of email transmissions.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Vince Collins (NHJobs.com)
03/23/2007 08:58 AM

I was told when I began this project by the LDAP administrator that it is storing images in base64.  So I just encoded the binary file as toBase64() and the database took it just fine but it actually wasn't just fine.  All images uploaded my my tool where corrupt.  By using a third party tool, the images showed as corrupt with errors like "may be partially truncated or otherwise invalid".  Using a third party tool it also qualified my newly uploaded images at "Text Attributes" while the other good images were qualified as "Binary Attributes". As you say, it appears something might be lost in translation between cfldap and the underlying Java code. I have never worked with Java before and am a bit nervous venturing into it today but at this point, if I'm going to call myself a programmer, I suppose I better attempt to actually be one and take this challenge on. Thanks for your help, I will now look into trying to figure out what CFLDAP is calling and go from there. Best Regards, Leitch, Oblio wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Vince Collins (NHJobs.com)
03/28/2007 09:44 AM

I am now updating images within LDAP by using CFHTTP to call an ASP page... > As you say, it appears something might be lost in translation between cfldap and the underlying Java code. >   While looking into Java for a solution, a smart co-worker (thanks Peter Jacoby!) wrote a .NET script that updates the photo directly in its binary form. COLDFUSION CODE: <cfif Trim(seljpegPhoto) neq ""> <cftry> <!--- upload image ---> <cffile action="upload" filefield="seljpegPhoto" destination="#root#\update\upload" nameconflict="overwrite"> <!--- cfhttp call passes file name to update.aspx which updates the photo ---> <cfhttp url="#webroot#qry/update.aspx?CN=#qry_get_one_emp.cn#&photo=#file.serverfile#" method="GET"></cfhttp> <cfcatch type = "Any">   <cfset err = "#err#<li>There was an LDAP error updating your image.</li><br>"> </cfcatch> </cftry> <!--- we print a 1 in update.aspx page if successful ---> <cfif IsDefined("cfhttp.fileContent") and Trim(cfhttp.fileContent) neq 1>   <cfset err = "#err#<li>There was an LDAP error updating your image.</li><br>"> </cfif> </cfif> UPDATE.ASPX CODE: <% @Page Language="C#" Debug="true" CompilerOptions='/R:"c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.DirectoryServices.dll"'%> <%@ Import Namespace="System.DirectoryServices" %> <script runat="server">     void Page_Load(object sender, EventArgs e)     {         //_LDAPSERVER_ is your server and _LDAPUSERNAME_ & _LDAPPASSWORD_ is a username/password that has rights to update the binary attribute         System.Drawing.Image imgInFile = System.Drawing.Image.FromFile(Server.MapPath("../update/upload/" + Request.QueryString["photo"]));         System.IO.MemoryStream ms = new System.IO.MemoryStream();         imgInFile.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);         DirectoryEntry personInfo = new DirectoryEntry("LDAP://_LDAPSERVER_/CN=" + Request.QueryString["CN"] + ",OU=NA,OU=Employees,O=Teleatlas,C=Global", "_LDAPUSERNAME_", "_LDAPPASSWORD_", AuthenticationTypes.None);         try         {             personInfo.Properties["jpegPhoto"][0] = ms.ToArray();             personInfo.CommitChanges();             Response.Write ("1");         }         catch         {             Response.Write ("ERROR: Cannot find employee " + Request.QueryString["CN"]);             ms.Close();             imgInFile = null;             Response.End();         }         ms.Close();         imgInFile = null;     } </script> Thanks everyone for your help on this.  I'm disappointed that CF couldn't do it.  Or maybe I should reword that as "I'm disappointed I couldn't figure out a CF-only solution". CF Wish list:  CFLDAP with a file option like...   <cfldap action="modify"            DN="#qry_get_one_emp.distinguishedName#"            attributes="jpegPhoto"            files="#file.serverfile#"            modifytype="replace"            server="#LDAPServer#"            username="#LDAPUsername#"            password="#LDAPPassword#"> At any rate, I can now move on with my development and I thank everyone for their help on this.  Especially Peter Jacoby! -Vince

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Vince Collins (NHJobs.com)
03/23/2007 08:46 AM

Thanks Dinner, Looking under the hood of CF sounds a bit scary but only because I have never done it before. I very much appreciate your suggestion and may have questions along the way. Dinner wrote: ----- Excess quoted text cut - see Original Post for more -----


<< Previous Thread Today's Threads Next Thread >>

Mailing Lists