From e91426510817dfa8bf8dcfa99353aeac43bd6d19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lud=C4=9Bk=20Nov=C3=BD?= <13610612+ludeknovy@users.noreply.github.com> Date: Tue, 10 Dec 2024 17:38:24 +0100 Subject: [PATCH] Change log level from info to debug in authorization middleware --- src/server/middleware/authorization-middleware.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/middleware/authorization-middleware.ts b/src/server/middleware/authorization-middleware.ts index 802a7584..de459517 100644 --- a/src/server/middleware/authorization-middleware.ts +++ b/src/server/middleware/authorization-middleware.ts @@ -6,14 +6,14 @@ import { isUserAuthorizedForProject } from "../queries/user-project-access" export const authorizationMiddleware = (allowedRoles: AllowedRoles[]) => { return async (request, response, next) => { const user = request.user - logger.info(`User ${user.userId} with role ${user.role} accessing a resource with allowed roles: ${allowedRoles}`) + logger.debug(`User ${user.userId} with role ${user.role} accessing a resource with allowed roles: ${allowedRoles}`) // check project authorization const { projectName } = request.params if (projectName && user?.userId && user?.role !== AllowedRoles.Admin) { - logger.info(`User ${user.userId} with role ${user.role} accessing a resource within ${projectName} project`) + logger.debug(`User ${user.userId} with role ${user.role} accessing a resource within ${projectName} project`) const userAuthorizedForProject = await db.oneOrNone(isUserAuthorizedForProject(projectName, user.userId)) if (!userAuthorizedForProject && user.role) { - logger.info(`User ${user.userId} has no access to project ${projectName}`) + logger.debug(`User ${user.userId} has no access to project ${projectName}`) return next(boom.forbidden(`You dont have permission to access`)) } // user is authorized, we can proceed