Add user avatars to LDAP, upload on profile settings page #148
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "feature/123-user_avatars"
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?
Allow users to upload avatars, resized to 512px square and stored as
jpegPhoto
in LDAP, where it can be used from Gitea, ejabberd, etc..I started implementing this using ActiveStorage, but then realized it's much nicer to not require any separate file storage in addition to LDAP for this, because everything will be fast enough to just retrieve the avatar from there and re-process it if necessary. However, I left in the ActiveStorage configs (all local disk for now), so we can use it for other things, like e.g. the app icons in #142.
The avatar is also shown on the admin user page, but no fancy layout there as of now.
closes #123
We'll need to create a custom Docker image on top of
guildeducation/rails
, in order to install thelibvips
package. Out of time just now, but will look at it later. We can host it directly on this Gitea's Docker registry.Overall the changes look good to me. I find the name
jpegPhoto
a bit odd. Did you choose that deliberately or is that something LDAP specific?@ -0,0 +7,4 @@
def call
treebase = @ou ? "ou=#{@ou},cn=users,#{suffix}" : ldap_config["base"]
puts treebase.inspect
✂️
@ -65,1 +65,4 @@
<section class="sm:flex-1 sm:pt-0">
<h3>LDAP<h3>
<p>
<img src="data:image/png;base64,<%= @avatar %>" class="h-48 w-48" />
Shouldn't this be
image/jpeg
?Yes! Thanks.
Yes, it's a standardized property name: https://www.rfc-editor.org/rfc/rfc2798#section-2.6