correct all req.user property references in controllers
This commit is contained in:
@@ -79,8 +79,8 @@ export async function getUserById(
|
|||||||
|
|
||||||
// Check if user is admin or requesting their own data
|
// Check if user is admin or requesting their own data
|
||||||
const requestingUser = req.user;
|
const requestingUser = req.user;
|
||||||
const isAdmin = requestingUser?.role === 'ADMIN';
|
const isAdmin = requestingUser?.roleName === 'ADMIN';
|
||||||
const isSelf = requestingUser?.id === userId;
|
const isSelf = requestingUser?.userId === userId;
|
||||||
|
|
||||||
if (!isAdmin && !isSelf) {
|
if (!isAdmin && !isSelf) {
|
||||||
res.status(403).json({
|
res.status(403).json({
|
||||||
@@ -177,8 +177,8 @@ export async function updateUser(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const requestingUser = req.user;
|
const requestingUser = req.user;
|
||||||
const isAdmin = requestingUser?.role === 'ADMIN';
|
const isAdmin = requestingUser?.roleName === 'ADMIN';
|
||||||
const isSelf = requestingUser?.id === userId;
|
const isSelf = requestingUser?.userId === userId;
|
||||||
|
|
||||||
if (!isAdmin && !isSelf) {
|
if (!isAdmin && !isSelf) {
|
||||||
res.status(403).json({
|
res.status(403).json({
|
||||||
|
|||||||
Reference in New Issue
Block a user