dataflake.org

Home Documentation Software Old Stuff

Updating jpegPhoto (Resolved)

Request LDAP User Folder -- question -- by Dragos Chirila
Posted on Mar 31, 2008 1:07 pm
Subscribe

Enter your email address to receive mail on every change to this issue.

Entries (Latest first)


  Resolve by Jens Vagelpohl on Jul 19, 2008 6:31 am
  Closing due to inactivity. I'm assuming it works until proven wrong.
 

  Comment by Dragos Chirila on Jun 2, 2008 11:38 am
  Hi Jens,

Sure, I will test it tomorrow and I will be back with an answer.

Regards,
Dragos
 

  Comment by Jens Vagelpohl on May 30, 2008 4:32 pm
  Hi Dragos,

Could you do me a favor and test the latest code from the Subversion repository? I have made changes to accommodate binary attributes if you declare them as binary attribute on the LDAP Schema tab:

http://svn.dataflake.org/viewvc?view=rev&revision=1477

 

  Comment by Dragos Chirila on Apr 1, 2008 5:17 am
  Hi Jens,

I have solved the problem, successfully write, read and delete jpegPhoto value in the LDAP. I had to write a hotfix that adds the modified version of two methods LDAPUserFolder. manage_setUserProperty and LDAPDelegate.modify. In both methods I have removed the code that encodes to utf8 the value to be saved in the LDAP. So:

1. to write: manage_setUserPropertyEx(user_dn=..., prop_name='jpegPhoto', prop_value=file.read())
2. te delete: manage_setUserPropertyEx(user_dn=..., prop_name='jpegPhoto', prop_value=None)
3. to read I have this method:

security.declareProtected(view, 'getUserAvatar')
def getUserAvatar(self, name):
""" """
return self.getPhysicalRoot().acl_users.getUser(name).avatar

and in ZPT:

<img tal:attributes="src string:${site_url}/getUserAvatar?name=${...}" ... />

Hope this will help.

Thanks again,
Dragos
 

  Comment by Jens Vagelpohl on Mar 31, 2008 1:34 pm
  I honestly don't know. I never had the need to manipulate binary
fields such as jpegPhoto. I don't even know if this is possible using
python-ldap.


 

  Initial Request by Dragos Chirila on Mar 31, 2008 1:07 pm
  Hi Jens,

I am trying to modify the jpegPhoto field in the LDAP (upload a picture). I have succesfully read this property and it works perfect - the image display ok.

Basically I am calling the method manage_setUserProperty with prop_name='jpegPhoto' and the question is how to pass the prop_value. I have tried in different ways (file.read() or base64.encodestring(file.read()) and it doesn't work.

Could you please guide me on how to pass the correct value?

Thank you very much.