Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(server): Allow activating non-admin user with server license #11206

Merged
merged 4 commits into from
Jul 26, 2024

Conversation

stephen304
Copy link
Contributor

Here's a small suggestion to allow non-admin users to activate their user account with a server license. This would allow a user to move between a self-hosted server to server managed by someone else and not need to buy an individual user license if they already have a server license.

Only a few changes:

  • Change user endpoint to accept both server/client licenses
  • Change web logic so that the behavior for admins stays the same (server license -> server service, invididual license -> user service), but for non-admins both individual and server licenses go to the user service (currently entering a server license as a non-admin causes web to try to activate the server through the server endpoint, which of course fails due to not being an admin)
  • Added test for user endpoint to accept server licenses

@stephen304 stephen304 changed the title feat(server,web): Allow activating non-admin user with server license feat(server): Allow activating non-admin user with server license Jul 19, 2024
@jrasm91 jrasm91 requested a review from zackpollard July 19, 2024 04:13
Copy link
Member

@danieldietzler danieldietzler left a comment

Choose a reason for hiding this comment

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

This sounds logical to me, thanks!

@stephen304
Copy link
Contributor Author

stephen304 commented Jul 19, 2024

Hmmm it appears I made an oversight in the frontend part, the user.isAdmin is not working right so it only uses the user activation endpoint even when you are admin and use a server key. It appears isAdmin is on the object (UserAdminResponseDto) on the definition but linting says otherwise, so I'm not sure how to make this work.

Edit: I think I found the right way to get the user, tested with a server key on a non-admin and with admin. It activated the user account when non-admin and activated the server when used as admin.

@alextran1502 alextran1502 merged commit ade2901 into immich-app:main Jul 26, 2024
22 checks passed
@stephen304 stephen304 deleted the server-license-as-user branch July 26, 2024 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants