mirror of
https://github.com/immich-app/immich.git
synced 2025-12-24 01:11:32 +03:00
feat(server): Allow activating non-admin user with server license (#11206)
* feat(server): allow server license to activate a user * feat(web): send server+client licenses to user activation when non-admin * chore(server): update test to allow server license to activate user * fix(web): correctly load user to determine where to save license
This commit is contained in:
@@ -274,7 +274,7 @@ describe(UserService.name, () => {
|
||||
});
|
||||
|
||||
describe('setLicense', () => {
|
||||
it('should save license if valid', async () => {
|
||||
it('should save client license if valid', async () => {
|
||||
userMock.upsertMetadata.mockResolvedValue();
|
||||
|
||||
const license = { licenseKey: 'IMCL-license-key', activationKey: 'activation-key' };
|
||||
@@ -286,6 +286,18 @@ describe(UserService.name, () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should save server license as client if valid', async () => {
|
||||
userMock.upsertMetadata.mockResolvedValue();
|
||||
|
||||
const license = { licenseKey: 'IMSV-license-key', activationKey: 'activation-key' };
|
||||
await sut.setLicense(authStub.user1, license);
|
||||
|
||||
expect(userMock.upsertMetadata).toHaveBeenCalledWith(authStub.user1.user.id, {
|
||||
key: UserMetadataKey.LICENSE,
|
||||
value: expect.any(Object),
|
||||
});
|
||||
});
|
||||
|
||||
it('should not save license if invalid', async () => {
|
||||
userMock.upsertMetadata.mockResolvedValue();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user