Check if existing signing conditions belong to a revoked user

This commit is contained in:
pablof7z 2023-07-08 12:34:51 +02:00
parent 88811fbcd2
commit c7f546add1
2 changed files with 16 additions and 1 deletions

View File

@ -5,6 +5,7 @@ COPY package.json package-lock.json .
RUN npm i
COPY src/ src/
COPY scripts scripts/
COPY prisma/schema.prisma prisma/
COPY tsconfig.json .
@ -17,5 +18,5 @@ RUN npm run build
RUN npm i
RUN npx prisma migrate deploy
ENTRYPOINT [ "node", "dist/index.js" ]
ENTRYPOINT [ "node", "scripts/start.js" ]
CMD ["start"]

View File

@ -46,6 +46,20 @@ export async function checkIfPubkeyAllowed(
const allowed = signingCondition.allowed;
// Check if the key user has been revoked
if (allowed) {
const revoked = await prisma.keyUser.findFirst({
where: {
id: keyUser.id,
revokedAt: { not: null },
}
});
if (revoked) {
return false;
}
}
if (allowed === true || allowed === false) {
console.log(`found signing condition`, signingCondition);
return allowed;