mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00: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:
parent
d180373ec1
commit
ade2901259
3 changed files with 29 additions and 7 deletions
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue