Add user avatars to LDAP, upload on profile settings page #148

Merged
raucao merged 11 commits from feature/123-user_avatars into master 2023-09-13 13:01:25 +00:00
Owner

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

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
raucao added the
feature
kredits-2
labels 2023-09-07 09:49:41 +00:00
raucao added 8 commits 2023-09-07 09:49:42 +00:00
continuous-integration/drone/push Build is passing Details
def44618ef
Comments
continuous-integration/drone/push Build is failing Details
d5ab532947
Store and retrieve avatars in/from LDAP exclusively
No need to keep them in two places at the same time. We can fetch them
from LDAP whenever we want to do something with them.
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/pr Build is failing Details
dfcdbec0dd
Add specs for avatar upload
Author
Owner

We'll need to create a custom Docker image on top of guildeducation/rails, in order to install the libvips package. Out of time just now, but will look at it later. We can host it directly on this Gitea's Docker registry.

We'll need to create a custom Docker image on top of `guildeducation/rails`, in order to install the `libvips` package. Out of time just now, but will look at it later. We can host it directly on this Gitea's Docker registry.
raucao added 1 commit 2023-09-07 21:35:51 +00:00
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
b810e27480
Use custom docker image with libvips installed in CI
raucao requested review from Core 2023-09-08 07:09:25 +00:00
galfert approved these changes 2023-09-13 11:45:34 +00:00
galfert left a comment
Owner

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?

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
Owner

✂️

✂️
raucao marked this conversation as resolved
@ -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" />
Owner

Shouldn't this be image/jpeg?

Shouldn't this be `image/jpeg`?
Author
Owner

Yes! Thanks.

Yes! Thanks.
raucao marked this conversation as resolved
raucao added 2 commits 2023-09-13 12:49:32 +00:00
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
Release Drafter / Update release notes draft (pull_request) Successful in 3s Details
9c4c5c2553
Use correct content type for image
raucao merged commit 7a5fd46835 into master 2023-09-13 13:01:25 +00:00
raucao deleted branch feature/123-user_avatars 2023-09-13 13:01:25 +00:00
Author
Owner

I find the name jpegPhoto a bit odd. Did you choose that deliberately or is that something LDAP specific?

Yes, it's a standardized property name: https://www.rfc-editor.org/rfc/rfc2798#section-2.6

> I find the name `jpegPhoto` a bit odd. Did you choose that deliberately or is that something LDAP specific? Yes, it's a standardized property name: https://www.rfc-editor.org/rfc/rfc2798#section-2.6
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: kosmos/akkounts#148
No description provided.