Skip to content

Conversation

ildyria
Copy link
Member

@ildyria ildyria commented Jun 10, 2025

This pull request introduces a new feature for generating user invitation links, along with several related improvements to user management functionality and API consistency. Key changes include the addition of an invitation link feature, updates to API endpoints for consistency, and enhancements to the registration process.

New Feature: User Invitation Links

  • Added invitationLink method in UserManagementController to generate temporary invitation links for user registration, leveraging signed URLs and configurable expiration (user_invitation_ttl). ([app/Http/Controllers/Admin/UserManagementController.phpR104-R130](https://github.com/LycheeOrg/Lychee/pull/3433/files#diff-78067725a56ae103bb435a6a4f662818e59354672e73e1611aeaec9c8bf0631eR104-R130))
  • Created a new Vue component InviteUser.vue to display and copy invitation links, with a user-friendly modal interface. ([resources/js/components/modals/InviteUser.vueR1-R58](https://github.com/LycheeOrg/Lychee/pull/3433/files#diff-466a49115ca708078eece0fde0c59e9b04087db2e01556abb011164caa2530aeR1-R58))
  • Added a new configuration option user_invitation_ttl to set the expiration time for invitation links, implemented via a migration. ([database/migrations/2025_06_10_220804_user_invitation_ttl.phpR1-R31](https://github.com/LycheeOrg/Lychee/pull/3433/files#diff-371532fd4ece9ca2e2a059e3fa21efc4918f4407465a83c34579d52f318ea18dR1-R31))

API Improvements

  • Updated API routes for user management to use RESTful conventions (POST, PATCH, DELETE) instead of custom route names (e.g., UserManagement::createUserManagement). ([routes/api_v2.phpL149-R152](https://github.com/LycheeOrg/Lychee/pull/3433/files#diff-dba9a30b214808bd1ac63349d1e384b6cbd8d80ef675e4bd7cf0d0ee31c961e8L149-R152))
  • Added a new UserManagement::invite route for generating invitation links. ([routes/api_v2.phpL149-R152](https://github.com/LycheeOrg/Lychee/pull/3433/files#diff-dba9a30b214808bd1ac63349d1e384b6cbd8d80ef675e4bd7cf0d0ee31c961e8L149-R152))

Registration Enhancements

  • Modified RegistrationRequest to forbid registration when the user is already logged in and to support signed URLs for invitation-based registration. ([app/Http/Requests/Profile/RegistrationRequest.phpL34-R40](https://github.com/LycheeOrg/Lychee/pull/3433/files#diff-a14ad85e096cbcd35a05e63e92db6d5363f763da28238a356d00c8eb66161af6L34-R40))
  • Updated ProfileService.register to include signature and expires parameters for handling signed invitations. ([resources/js/services/profile-service.tsL22-R32](https://github.com/LycheeOrg/Lychee/pull/3433/files#diff-03f9125d953b68763446d9a225c48b70b78dc9f445ff68db6e0c11b400ebd166L22-R32))
  • Enhanced the registration page (RegisterPage.vue) to parse and use query parameters for signed invitations. ([resources/js/views/RegisterPage.vueR97-R123](https://github.com/LycheeOrg/Lychee/pull/3433/files#diff-6b333490831101eb0d7bfa4568d85c036fbaf586fb06a3389bdfc722c08a3ef5R97-R123))

Frontend Updates for User Management

  • Added an "Invite User" button to the user management view (Users.vue) to trigger the invitation modal. ([resources/js/views/Users.vueL18-R20](https://github.com/LycheeOrg/Lychee/pull/3433/files#diff-3eda16e5e7df3d55625c0f7257195222933cfb9e2cd5c56e50401651b79e2e72L18-R20))
  • Integrated the UserManagementService.invite method to fetch invitation links. ([resources/js/services/user-management-service.tsL24-R36](https://github.com/LycheeOrg/Lychee/pull/3433/files#diff-16f54ae340fbc769b601a09480c0cc59198a8a0b6c7f1a6fda24a9c2c855d1a3L24-R36))

Tests and Validation

  • Added tests to validate the new invitation link functionality and ensure proper handling of registration under different conditions (e.g., logged-in users, disabled registration). ([tests/Feature_v2/User/RegisterTest.phpR87-R112](https://github.com/LycheeOrg/Lychee/pull/3433/files#diff-57449503a97137c1c3443211e5ce1b5e6996d8dcd74893830537c7794d8cfa5fR87-R112))
  • Updated existing tests for user creation, deletion, and editing to align with the new RESTful API routes. ([[1]](https://github.com/LycheeOrg/Lychee/pull/3433/files#diff-b99e6e5dbe7b9e5baccb137f5a90cdcca4da8d64ad22cf2daf831428c1d323ceL27-R38), [[2]](https://github.com/LycheeOrg/Lychee/pull/3433/files#diff-3910aff3f02feda247afa318f12b1edb192f9d2e2de7022ede133a40450542f2L28-R36), [[3]](https://github.com/LycheeOrg/Lychee/pull/3433/files#diff-2e508d1f97930e607aea350bea197c1834484959f97aceb24678cb5d3799f7efL27-R38))

@ildyria ildyria requested a review from a team as a code owner June 10, 2025 22:10
@ildyria ildyria added the Review: easy Easy review expected: probably just need a quick to go through. label Jun 10, 2025
Copy link

codecov bot commented Jun 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.53%. Comparing base (ae1494c) to head (a237912).
Report is 8 commits behind head on master.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ildyria ildyria added the alpha-ready Branch is available in alpha label Jun 23, 2025
@click="copy"
>{{ link }}</span
>
<p class="text-muted">{{ sprintf($t("users.invite.link_is_valit_x_days"), days) }}</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

valit should be valid

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like all the translation files will need an update too, sorry

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no worries. :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 2661551

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed aa8758f

@ildyria ildyria requested a review from JasonMillward June 25, 2025 08:37
@ildyria ildyria merged commit bf39150 into master Jun 26, 2025
35 checks passed
@ildyria ildyria deleted the invite/link branch June 26, 2025 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alpha-ready Branch is available in alpha Review: easy Easy review expected: probably just need a quick to go through.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants