-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Field Request: Ability to set Profile Pic with LDAP #4144
Comments
gogs can this maybe its easy to copy that feature ? |
@tcs-ulli could you point where is the code base? |
In openldap attribute name is jpegPhoto (from inetOrgPerson), it is binary and it is stored in LDAP. working code example (in java) |
Using fusiondirectory, the jpegPhoto as mentioned by @mq2035 really makes sense. It should be updated like the other entries to pull changes from ldap. |
Yes, would be good, as I have stored jpegPhoto in my Samba4/LDAP server. Many Applications use the photo from LDAP server, which makes sense. |
Only problem could be with sync, how to check and download images only if they have been changed to not download all user images on every sync |
That would be an additional piece needed. Most apps I've seen do it on individual login, and then refetch on an administrator's cache clear, or when a scheduled job runs. Ideally it's something you could cache a day or two, since pictures don't change often, especially if you're updating on the login event. |
Let the user decide in his settings. |
I was just thinking if there is more optimal way to check if image has changed |
It would be a good start if there is just a |
Or check/download avatar on each user login. |
Any progress with this? I just got LDAP to work after days of fighting with it but no pictures sadly. |
I have put up a PR. It could do with some testing from people with working LDAPs. |
Add setting to LDAP source to allow it to provide an Avatar. Currently this is required to point to the image bytes. Fix go-gitea#4144 Signed-off-by: Andrew Thornton <art27@cantab.net>
Any chance for me to try that in Docker? I'm using v1.15.0 docker image. (centos 7) Can't try this as local installation. |
OK I've pushed up a docker image based on 1.16 (v1.16.0-dev-195-gd01836f4f) - this PR can't be backported to 1.15 without significant work (and as it would be a feature would be unlikely to be merged.) https://www.eldritchkitty.com/~andrew/gitea-1.16.0-dev-195-pr-16851.tar.gz if the image needs updating please discuss with me on discord or matrix. Similarly if a backport to 1.15 is wanted. |
Okay so if I want to just try that and then go back I should not just rename image in docker-compose.yml from gitea:1.15 to gitea:1.16-dev (as I renamed your docker) (and there back to 1.15) I should stop my current Gitea instance, copy folder with data and try your docker image on that? |
Ah you want to use your current data! You would need to backup or copy your db as there are some database migrations. (There's a small bug in 1.15.0 dump which will break login_source so you would need to use your db backups or wait for 1.15.1 - which is imminent) |
I would try that in production in my company so... To be safe, I will wait :-) So when 1.15.1 is out, I will update to that, then try to use your 1.16.0-dev, report functionality, then I can go back to 1.15.1? |
1.15.1 here. Should I wait for your docker build and go back to 1.15.1 after I try it? Or I have to duplicate my environment and try that on duplicated DB to be sure. |
You will need to back up your db, duplicate it and use the image I provided above. The reason is that once you use a 1.16-dev build your db is migrated and so you would not be a able to go back to 1.15. |
Finally at work. Did try your image but error happened. Are you sure (did you try it?) it works?
|
Sigh. Works for me. Not being a docker expert I don't know how to fix this or why it has occurred - at worst the image will contain a gitea binary which at worst you can copy over another image. |
Docker inspect gitea/gitea:1.16.0-dev, it will give me {"Config": {"Cmd": null, ...}, ...} Edit: after inspecting original 1.15 image, it is way too different. So my thoughts are it was not built correctly. |
It'll be the way it was exported. Clearly
|
Thanks. I copied it to a running container and there is a new field "Avatar Attribute" and entered "thumbnailPhoto" My
Still the random avatar. What should I do so that it will pull it out from LDAP? |
hmm... the avatar was only being updated if something else was updated on the user - I've changed that. The other question is whether your ldap is giving us the data as []byte or as a base64 encoded string. If it's the latter then it's not currently handling that.
|
If I enter my |
@SonGokussj4 did you try the update above? |
Hi. No I didn't. We use base64 for image and you wrote it doesn't handle the base64 so I didn't even try. |
I don't think you can assume that you're using base64 from that output. If you look at your output above:
There is a double Because if I have to convert for you - it is very likely that there will have to be conversions for others. If I don't then that's fine and I can save 200 lines of code messing around with dealing with this issue. |
That makes sense. Thanks for the explanation. |
So I updated the file, restarted gitea
Edit:
Not sure what's happening. |
OK I think I've got it working completely now! (Discovered our test ldap actually had jpegPhoto attributes already so was able to use that.) I wasn't actually passing the attribute to the LDAP request. https://www.eldritchkitty.com/~andrew/gitea-v1.16.0-dev-262-g5f7352645-pr-16851-linux-amd64.xz |
Hi, sorry for the delay, I wasn't at work till now. And... It WORKS!! I had to do Edit: New user logged in and his picture was automatically applied. So nice! |
* Allow LDAP Sources to provide Avatars Add setting to LDAP source to allow it to provide an Avatar. Currently this is required to point to the image bytes. Fix #4144 Signed-off-by: Andrew Thornton <art27@cantab.net> * Rename as Avatar Attribute (drop JPEG) Signed-off-by: Andrew Thornton <art27@cantab.net> * Always synchronize avatar if there is change Signed-off-by: Andrew Thornton <art27@cantab.net> * Actually get the avatar from the ldap Signed-off-by: Andrew Thornton <art27@cantab.net> * clean-up Signed-off-by: Andrew Thornton <art27@cantab.net> * use len()>0 rather than != "" Signed-off-by: Andrew Thornton <art27@cantab.net> * slight shortcut in IsUploadAvatarChanged Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
It would be neat to be able to set profile picture with LDAP. I suppose this would be best implemented as a URL, but I know there are multiple ways of implementing images in ldap.
The text was updated successfully, but these errors were encountered: