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

View File

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