Skip to content

Commit

Permalink
Merge pull request #89 from arati-tekdi/main
Browse files Browse the repository at this point in the history
Change in regex
  • Loading branch information
Shubham4026 authored Feb 25, 2025
2 parents 3e7a3b7 + cbd578b commit 1ca9d57
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 38 deletions.
37 changes: 0 additions & 37 deletions src/common/guards/jwt.strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,43 +33,6 @@ export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') {

async validate(request: any, payload: any) {
let userPrivileges;
// const ttl = this.configService.get('TTL');
// //try {
// const tenantId = request.headers['tenantid'];
// if (!tenantId?.trim()) {
// throw new BadRequestException('Tenant id not found');
// }
// request.userId = payload.sub;
// const requiredPermissions = request.requiredPermissions;

// const cachedData: UserPrivilegeRoleDto = await this.cacheService.get(
// payload.sub,
// );
// if (!cachedData) {
// const userPrivilegesAndRoles: any =
// await this.permissionService.getUserPrivilegesAndRoles(
// payload.sub,
// tenantId,
// );
// if (userPrivilegesAndRoles.length == 0) {
// throw new UnauthorizedException(
// 'User does not have any privileges in the Tenant',
// );
// }
// userPrivileges = userPrivilegesAndRoles['privileges'][tenantId]
// ? userPrivilegesAndRoles['privileges'][tenantId]
// : [];
// this.cacheService.set(payload.sub, userPrivilegesAndRoles, ttl);
// } else {
// userPrivileges = cachedData.privileges[tenantId]
// ? cachedData.privileges[tenantId]
// : [];
// }
// if (!userPrivileges && userPrivileges.length == 0) {
// throw new UnauthorizedException(
// 'User does not have any privileges in the Tenant',
// );
// }
this.middlewareLogger.log(
`user : ${payload.sub - payload.username} userPrivileges: ${userPrivileges}`,
);
Expand Down
2 changes: 1 addition & 1 deletion src/common/middleware/apiConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1646,7 +1646,7 @@ export const apiListForAcademicYear = [
];

function convertToRegex(pattern) {
const regexString = pattern.replace(/:[^\s/]+/g, '([\\w:-]+)');
const regexString = pattern.replace(/:[^\s/]+/g, '([\\w:-_]+)');
return new RegExp(`^${regexString}$`);
}

Expand Down

0 comments on commit 1ca9d57

Please sign in to comment.