fix: remove usage of Role.UPC

This commit is contained in:
Eli Bosley
2025-01-08 12:55:11 -05:00
parent 286ffc54e5
commit ceac6269b3
2 changed files with 8 additions and 8 deletions

View File

@@ -22,7 +22,7 @@ describe('AuthService', () => {
id: '10f356da-1e9e-43b8-9028-a26a645539a6',
name: 'Test API Key',
description: 'Test API Key Description',
roles: [Role.GUEST, Role.UPC],
roles: [Role.GUEST, Role.CONNECT],
createdAt: new Date().toISOString(),
};
@@ -39,7 +39,7 @@ describe('AuthService', () => {
id: '-1',
description: 'Test User',
name: 'test_user',
roles: [Role.GUEST, Role.UPC],
roles: [Role.GUEST, Role.CONNECT],
};
beforeEach(async () => {
@@ -134,13 +134,13 @@ describe('AuthService', () => {
const mockApiKeyWithoutRole = {
...mockApiKey,
roles: [Role.UPC],
roles: [Role.ADMIN],
};
vi.spyOn(apiKeyService, 'findById').mockResolvedValue(mockApiKeyWithoutRole);
vi.spyOn(apiKeyService, 'findByIdWithSecret').mockResolvedValue({
...mockApiKeyWithSecret,
roles: [Role.UPC],
roles: [Role.ADMIN],
});
vi.spyOn(apiKeyService, 'saveApiKey').mockResolvedValue();
vi.spyOn(authzService, 'addRoleForUser').mockResolvedValue(true);
@@ -152,7 +152,7 @@ describe('AuthService', () => {
expect(apiKeyService.findByIdWithSecret).toHaveBeenCalledWith(apiKeyId);
expect(apiKeyService.saveApiKey).toHaveBeenCalledWith({
...mockApiKeyWithSecret,
roles: [Role.UPC, role],
roles: [Role.ADMIN, role],
});
expect(authzService.addRoleForUser).toHaveBeenCalledWith(apiKeyId, role);
});

View File

@@ -220,9 +220,9 @@ export class AuthService {
this.logger.debug('getSessionUser called!');
return {
id: '-1',
description: 'UPC service account',
name: 'upc',
roles: [Role.UPC],
description: 'Session receives administrator permissions',
name: 'admin',
roles: [Role.ADMIN],
};
}
}