mirror of
https://github.com/go-gitea/gitea.git
synced 2026-07-16 21:53:50 -05:00
New Field Request: Ability to set Profile Pic with LDAP #1871
Closed
opened 2025-11-02 04:15:57 -06:00 by GiteaMirror
·
34 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1.16.3
v1.16.2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v1.4.0-rc1
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#1871
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @benyanke on GitHub (Jun 6, 2018).
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.
@tcs-ulli commented on GitHub (Nov 21, 2018):
gogs can this maybe its easy to copy that feature ?
@lunny commented on GitHub (Nov 21, 2018):
@tcs-ulli could you point where is the code base?
@mq2035 commented on GitHub (Mar 14, 2019):
In openldap attribute name is jpegPhoto (from inetOrgPerson), it is binary and it is stored in LDAP.
working code example (in java)
https://github.com/xwiki-contrib/ldap/tree/master/ldap-authenticator
@dl5rcw commented on GitHub (Jan 18, 2020):
Using fusiondirectory, the jpegPhoto as mentioned by @mq2035 really makes sense. It should be updated like the other entries to pull changes from ldap.
@helmut72 commented on GitHub (Feb 12, 2020):
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.
@lafriks commented on GitHub (Feb 12, 2020):
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
@benyanke commented on GitHub (Feb 13, 2020):
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.
@helmut72 commented on GitHub (Feb 19, 2020):
Let the user decide in his settings.
@lafriks commented on GitHub (Feb 19, 2020):
I was just thinking if there is more optimal way to check if image has changed
@helmut72 commented on GitHub (Sep 1, 2020):
It would be a good start if there is just a
sync every x day/hoursetting with 0 to disable. Then it's the administrators choice. Better than no ldap photo sync.@nedvedad commented on GitHub (Feb 10, 2021):
Or check/download avatar on each user login.
@SonGokussj4 commented on GitHub (Aug 26, 2021):
Any progress with this? I just got LDAP to work after days of fighting with it but no pictures sadly.
@zeripath commented on GitHub (Aug 27, 2021):
I have put up a PR. It could do with some testing from people with working LDAPs.
@SonGokussj4 commented on GitHub (Sep 1, 2021):
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.
@zeripath commented on GitHub (Sep 1, 2021):
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.
@SonGokussj4 commented on GitHub (Sep 2, 2021):
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?
@zeripath commented on GitHub (Sep 2, 2021):
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)
@SonGokussj4 commented on GitHub (Sep 2, 2021):
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?
@SonGokussj4 commented on GitHub (Sep 3, 2021):
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.
@zeripath commented on GitHub (Sep 3, 2021):
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.
@SonGokussj4 commented on GitHub (Sep 6, 2021):
Finally at work. Did try your image but error happened. Are you sure (did you try it?) it works?
@zeripath commented on GitHub (Sep 6, 2021):
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.
@SonGokussj4 commented on GitHub (Sep 7, 2021):
Docker inspect gitea/gitea:1.16.0-dev, it will give me {"Config": {"Cmd": null, ...}, ...}
When I googled the problem it gave me "you have no Cmd in dockerfile".
Edit: after inspecting original 1.15 image, it is way too different. So my thoughts are it was not built correctly.
@zeripath commented on GitHub (Sep 8, 2021):
It'll be the way it was exported. Clearly
docker exportdid not work and is not the correct thing to do. I'm not certain how to make that work properly.~
I have pushed up an xz compressed binary to https://www.eldritchkitty.com/which once decompressed you can use to replace the /app/gitea/gitea binary within a working docker.andrew/gitea-v1.16.0-dev-219-g4b6e023a1-pr-16851-linux-amd64.xz@SonGokussj4 commented on GitHub (Sep 8, 2021):
Thanks. I copied it to a running container and there is a new field "Avatar Attribute" and entered "thumbnailPhoto"
My
ldapsearch -x -W -D xxxshows:Admin --> Monitoring --> Synchronize external user dataUser Profile --> Avatar --> Look Up Avatar by Email AddresstoUse Custom Avatarand backStill the random avatar. What should I do so that it will pull it out from LDAP?
https://i.imgur.com/zA2LxYh.png
@zeripath commented on GitHub (Sep 8, 2021):
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.
~
https://www.eldritchkitty.com/andrew/gitea-v1.16.0-dev-225-g929885e0c-pr-16851-linux-amd64.xz@SonGokussj4 commented on GitHub (Sep 8, 2021):
If I enter my
thumbnailPhotointo https://codebeautify.org/base64-to-image-converter, it gives me my picture. So I think (and I can't change that) it's base64.@zeripath commented on GitHub (Sep 10, 2021):
@SonGokussj4 did you try the update above?
@SonGokussj4 commented on GitHub (Sep 13, 2021):
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.
@zeripath commented on GitHub (Sep 13, 2021):
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
:after the field's name. That could imply that the object is stored as []byte but it's being rendered as base64. My code explicitly asks for the bytes. Now you were previously expecting synchronization to occur - it wasn't because of an oversight - but it does happen now. So it would be helpful to know if my interpretation above is correct or if I have to read the data and detect it's base64 and then do a conversion.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.
@SonGokussj4 commented on GitHub (Sep 13, 2021):
That makes sense. Thanks for the explanation.
I'll try that right away.
@SonGokussj4 commented on GitHub (Sep 14, 2021):
So I updated the file, restarted gitea
docker-compose restart, enteredthumbnailPhoto, then tried log-out, log-in, synchronize data, nothing.Then I downed docker
docker-compose downand started it againdocker-compose up -d, logs show me this:Edit:
Ignore the above. I repeated the copying (I forgot that when I
d-c downmy container, it will replace all default files...)I filled the
Avatar Attributefield but nothing happens.Interesting enough, I couldn't log back in.
The log was:
Not sure what's happening.
@zeripath commented on GitHub (Sep 15, 2021):
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
@SonGokussj4 commented on GitHub (Sep 20, 2021):
Hi, sorry for the delay, I wasn't at work till now. And...
It WORKS!!
I had to do
Monitoring -> Synchronize external user databut I think the newly added user should have his picture there. Will through today.Edit: New user logged in and his picture was automatically applied. So nice!
If this could be a functional PR and have it in the next version, that would be awesome.