Skip to content

Commit

Permalink
Merge branch 'dev' into enhancement/wait-for-http-success-before-dele…
Browse files Browse the repository at this point in the history
…te-modal-close
  • Loading branch information
Yagnik56 authored Jun 15, 2024
2 parents 17b6000 + eca6c01 commit be190bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 0 additions & 6 deletions backend/packages/Upgrade/src/auth/authorizationChecker.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Action } from 'routing-controllers';
import { Container } from 'typedi';
import { AuthService } from './AuthService';
import { env } from '../env';
import { UpgradeLogger } from '../lib/logger/UpgradeLogger';

export function authorizationChecker(): (action: Action, roles: any[]) => Promise<boolean> | boolean {
Expand All @@ -14,11 +13,6 @@ export function authorizationChecker(): (action: Action, roles: any[]) => Promis
// checker must return either boolean (true or false)
// either promise that resolves a boolean value

// for testing don't check authorization
if (env.isTest) {
return true;
}

const authService = Container.get<AuthService>(AuthService);
const token = authService.parseBasicAuthFromRequest(action.request);
if (token === undefined) {
Expand Down
5 changes: 5 additions & 0 deletions backend/packages/Upgrade/test/unit/lib/setup.ts
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
import 'reflect-metadata';

// Global mocks for authorizationChecker
jest.mock('../../../src/auth/authorizationChecker', () => ({
authorizationChecker: () => async () => true,
}));

0 comments on commit be190bc

Please sign in to comment.