Skip to content

Commit 5169969

Browse files
fix: added API params validations (#1124)
* fix: added API params validations Signed-off-by: pranalidhanavade <[email protected]> * fix: removed unneccessary roles from role gaurd Signed-off-by: pranalidhanavade <[email protected]> --------- Signed-off-by: pranalidhanavade <[email protected]>
1 parent ad69257 commit 5169969

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

apps/api-gateway/src/agent-service/agent-service.controller.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ export class AgentController {
7171
summary: 'Get the agent health details',
7272
description: 'Get the agent health details for the organization'
7373
})
74-
@UseGuards(AuthGuard('jwt'))
75-
async getAgentHealth(@Param('orgId') orgId: string, @User() reqUser: user, @Res() res: Response): Promise<Response> {
74+
@UseGuards(AuthGuard('jwt'), OrgRolesGuard)
75+
@Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.HOLDER, OrgRoles.ISSUER, OrgRoles.SUPER_ADMIN, OrgRoles.MEMBER, OrgRoles.VERIFIER)
76+
77+
async getAgentHealth(@Param('orgId') orgId: string, @User() reqUser: user, @Res() res: Response): Promise<Response> {
7678
const agentData = await this.agentService.getAgentHealth(reqUser, orgId);
7779

7880
const finalResponse: IResponse = {

apps/api-gateway/src/fido/fido.controller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class FidoController {
3030
* @returns User details
3131
*/
3232
@Get('/passkey/:email')
33-
@Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.HOLDER, OrgRoles.ISSUER, OrgRoles.SUPER_ADMIN, OrgRoles.SUPER_ADMIN, OrgRoles.MEMBER)
33+
@Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.HOLDER, OrgRoles.ISSUER, OrgRoles.SUPER_ADMIN, OrgRoles.MEMBER)
3434
@ApiBearerAuth()
3535
@ApiOperation({ summary: 'Fetch fido user details', description: 'Retrieve the details of a FIDO user by their email address.' })
3636
@ApiResponse({ status: HttpStatus.OK, description: 'Success', type: ApiResponseDto })
@@ -169,7 +169,7 @@ export class FidoController {
169169
* @returns Updated device name
170170
*/
171171
@Put('/passkey/:credentialId')
172-
@Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.HOLDER, OrgRoles.ISSUER, OrgRoles.SUPER_ADMIN, OrgRoles.SUPER_ADMIN, OrgRoles.MEMBER)
172+
@Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.HOLDER, OrgRoles.ISSUER, OrgRoles.SUPER_ADMIN, OrgRoles.MEMBER)
173173
@ApiBearerAuth()
174174
@ApiOperation({ summary: 'Update fido user device name', description: 'Update the device name of a FIDO user.' })
175175
@ApiQuery({ name: 'deviceName', required: true })
@@ -196,7 +196,7 @@ export class FidoController {
196196
* @returns Success message
197197
*/
198198
@Delete('/passkey/:credentialId')
199-
@Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.HOLDER, OrgRoles.ISSUER, OrgRoles.SUPER_ADMIN, OrgRoles.SUPER_ADMIN, OrgRoles.MEMBER)
199+
@Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.HOLDER, OrgRoles.ISSUER, OrgRoles.SUPER_ADMIN, OrgRoles.MEMBER)
200200
@ApiBearerAuth()
201201
@ApiOperation({ summary: 'Delete fido user device', description: 'Delete a FIDO user device by its credential ID.' })
202202
@ApiResponse({ status: HttpStatus.OK, description: 'Success', type: ApiResponseDto })

apps/api-gateway/src/organization/organization.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ export class OrganizationController {
315315
*/
316316

317317
@Get('/:orgId/users')
318-
@Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.HOLDER, OrgRoles.ISSUER, OrgRoles.SUPER_ADMIN, OrgRoles.SUPER_ADMIN, OrgRoles.MEMBER)
318+
@Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.HOLDER, OrgRoles.ISSUER, OrgRoles.SUPER_ADMIN, OrgRoles.MEMBER)
319319
@ApiBearerAuth()
320320
@UseGuards(AuthGuard('jwt'), OrgRolesGuard)
321321
@ApiResponse({ status: HttpStatus.OK, description: 'Success', type: ApiResponseDto })

0 commit comments

Comments
 (0)