From 01aadcf2f3039b775192839948405b3591ec4669 Mon Sep 17 00:00:00 2001 From: Esteban Date: Mon, 2 Feb 2026 01:03:53 -0600 Subject: [PATCH] correct all req.user property references in controllers --- water-api/src/controllers/user.controller.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/water-api/src/controllers/user.controller.ts b/water-api/src/controllers/user.controller.ts index a028b50..93e4bac 100644 --- a/water-api/src/controllers/user.controller.ts +++ b/water-api/src/controllers/user.controller.ts @@ -79,8 +79,8 @@ export async function getUserById( // Check if user is admin or requesting their own data const requestingUser = req.user; - const isAdmin = requestingUser?.role === 'ADMIN'; - const isSelf = requestingUser?.id === userId; + const isAdmin = requestingUser?.roleName === 'ADMIN'; + const isSelf = requestingUser?.userId === userId; if (!isAdmin && !isSelf) { res.status(403).json({ @@ -177,8 +177,8 @@ export async function updateUser( } const requestingUser = req.user; - const isAdmin = requestingUser?.role === 'ADMIN'; - const isSelf = requestingUser?.id === userId; + const isAdmin = requestingUser?.roleName === 'ADMIN'; + const isSelf = requestingUser?.userId === userId; if (!isAdmin && !isSelf) { res.status(403).json({