Skip to content

Admin Profile – upload avatar #31

Description

@amorindev

Objective

Allow the administrator to upload their profile picture from the admin panel.
It is not required to display it in the UI; it is sufficient to store it in MinIO.
Displaying the image can be handled in a separate issue.

Approach

The administrator is a User with roles.
No new domain logic should be created.
The existing UploadAvatar service from the identity/users module must be reused.

Scope

1. Sidebar

Add a new section “Profile” in the admin sidebar that redirects to the profile page.

2. Profile Page

Create profile.html in:

  • web/admin/templates

It must:

  • Display the basic admin data (email).
  • Allow uploading an image using multipart/form-data.

3. Handlers

Location:
web/admin/api/handler

Create:

  • ProfilePage: renders the view.
  • UploadAvatar: processes the form and calls UserSrv.UploadAvatar.
    • Code example: pkg/identity/users/handler/upload_avatar.go

4. Upload

  • Retrieve the userID from the claims (injected by the Authorize middleware).
  • Redirect back to the profile page after the upload.

5. Security

Protect the routes with:

Expected Result

The admin can access Profile, upload an avatar, and update their profile image.

Notes

  • Questions or better solutions should be discussed in the issue comments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions