[Permissions] Add userWorkspaceId to JWT token (#9954)

This information will be used to fetch a user's role and check their
permissions
This commit is contained in:
Marie
2025-01-31 18:15:29 +01:00
committed by GitHub
parent f00e7cc670
commit 58aa86cc0c
11 changed files with 124 additions and 7 deletions

View File

@ -0,0 +1,11 @@
import { ExecutionContext, createParamDecorator } from '@nestjs/common';
import { getRequest } from 'src/utils/extract-request';
export const AuthUserWorkspaceId = createParamDecorator(
(data: unknown, ctx: ExecutionContext) => {
const request = getRequest(ctx);
return request.userWorkspaceId;
},
);