diff --git a/backend/src/ee/services/permission/permission-dal.ts b/backend/src/ee/services/permission/permission-dal.ts index 8ad58f528..730ad3bbc 100644 --- a/backend/src/ee/services/permission/permission-dal.ts +++ b/backend/src/ee/services/permission/permission-dal.ts @@ -127,14 +127,15 @@ export const permissionDALFactory = (db: TDbClient) => { const getProjectPermission = async (userId: string, projectId: string) => { try { + const subQueryUserGroups = db(TableName.UserGroupMembership).where("userId", userId).select("groupId"); const docs = await db .replicaNode()(TableName.Users) .where(`${TableName.Users}.id`, userId) - .leftJoin(TableName.UserGroupMembership, `${TableName.UserGroupMembership}.userId`, `${TableName.Users}.id`) .leftJoin(TableName.GroupProjectMembership, (queryBuilder) => { void queryBuilder .on(`${TableName.GroupProjectMembership}.projectId`, db.raw("?", [projectId])) - .andOn(`${TableName.GroupProjectMembership}.groupId`, `${TableName.UserGroupMembership}.groupId`); + // @ts-expect-error akhilmhdh: this is valid knexjs query. Its just ts type argument is missing it + .andOnIn(`${TableName.GroupProjectMembership}.groupId`, subQueryUserGroups); }) .leftJoin( TableName.GroupProjectMembershipRole, diff --git a/backend/src/services/identity-token-auth/identity-token-auth-service.ts b/backend/src/services/identity-token-auth/identity-token-auth-service.ts index 39f2f6589..847030d76 100644 --- a/backend/src/services/identity-token-auth/identity-token-auth-service.ts +++ b/backend/src/services/identity-token-auth/identity-token-auth-service.ts @@ -385,8 +385,8 @@ export const identityTokenAuthServiceFactory = ({ actorOrgId }: TUpdateTokenAuthTokenDTO) => { const foundToken = await identityAccessTokenDAL.findOne({ - id: tokenId, - authMethod: IdentityAuthMethod.TOKEN_AUTH + [`${TableName.IdentityAccessToken}.id` as "id"]: tokenId, + [`${TableName.IdentityAccessToken}.authMethod` as "authMethod"]: IdentityAuthMethod.TOKEN_AUTH }); if (!foundToken) throw new NotFoundError({ message: `Token with ID ${tokenId} not found` }); @@ -444,8 +444,8 @@ export const identityTokenAuthServiceFactory = ({ }: TRevokeTokenAuthTokenDTO) => { const identityAccessToken = await identityAccessTokenDAL.findOne({ [`${TableName.IdentityAccessToken}.id` as "id"]: tokenId, - isAccessTokenRevoked: false, - authMethod: IdentityAuthMethod.TOKEN_AUTH + [`${TableName.IdentityAccessToken}.isAccessTokenRevoked` as "isAccessTokenRevoked"]: false, + [`${TableName.IdentityAccessToken}.authMethod` as "authMethod"]: IdentityAuthMethod.TOKEN_AUTH }); if (!identityAccessToken) throw new NotFoundError({