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:
Stephen Smith 2024-07-26 00:27:44 -04:00 committed by GitHub
parent d180373ec1
commit ade2901259
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 7 deletions

View file

@ -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();