fix: review changes

This commit is contained in:
Piyush Gupta
2025-12-03 02:33:50 +05:30
parent 0ae7eac810
commit 150b8fd397
3 changed files with 3 additions and 9 deletions
@@ -417,7 +417,7 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
}, },
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]), onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
schema: { schema: {
hide: false, hide: true,
tags: [ApiDocsTags.TokenAuth], tags: [ApiDocsTags.TokenAuth],
description: "Get token for machine identity with Token Auth", description: "Get token for machine identity with Token Auth",
security: [ security: [
@@ -441,8 +441,7 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
actor: req.permission.type, actor: req.permission.type,
actorId: req.permission.id, actorId: req.permission.id,
actorOrgId: req.permission.orgId, actorOrgId: req.permission.orgId,
actorAuthMethod: req.permission.authMethod, actorAuthMethod: req.permission.authMethod
isActorSuperAdmin: isSuperAdmin(req.auth)
}); });
await server.services.auditLog.createAuditLog({ await server.services.auditLog.createAuditLog({
@@ -493,8 +492,7 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
actor: req.permission.type, actor: req.permission.type,
actorId: req.permission.id, actorId: req.permission.id,
actorOrgId: req.permission.orgId, actorOrgId: req.permission.orgId,
actorAuthMethod: req.permission.authMethod, actorAuthMethod: req.permission.authMethod
isActorSuperAdmin: isSuperAdmin(req.auth)
}); });
await server.services.auditLog.createAuditLog({ await server.services.auditLog.createAuditLog({
@@ -621,7 +621,6 @@ export const identityTokenAuthServiceFactory = ({
const getTokenAuthTokenById = async ({ const getTokenAuthTokenById = async ({
tokenId, tokenId,
isActorSuperAdmin,
actorId, actorId,
actor, actor,
actorAuthMethod, actorAuthMethod,
@@ -644,8 +643,6 @@ export const identityTokenAuthServiceFactory = ({
throw new NotFoundError({ message: `Failed to find identity with ID ${foundToken.identityId}` }); throw new NotFoundError({ message: `Failed to find identity with ID ${foundToken.identityId}` });
} }
await validateIdentityUpdateForSuperAdminPrivileges(foundToken.identityId, isActorSuperAdmin);
if (!identityMembershipOrg.identity.authMethods.includes(IdentityAuthMethod.TOKEN_AUTH)) { if (!identityMembershipOrg.identity.authMethods.includes(IdentityAuthMethod.TOKEN_AUTH)) {
throw new BadRequestError({ throw new BadRequestError({
message: "The identity does not have Token Auth" message: "The identity does not have Token Auth"
@@ -42,7 +42,6 @@ export type TGetTokenAuthTokensDTO = {
export type TGetTokenAuthTokenByIdDTO = { export type TGetTokenAuthTokenByIdDTO = {
tokenId: string; tokenId: string;
isActorSuperAdmin?: boolean;
} & Omit<TProjectPermission, "projectId">; } & Omit<TProjectPermission, "projectId">;
export type TUpdateTokenAuthTokenDTO = { export type TUpdateTokenAuthTokenDTO = {