From e62d3fa83ab2e8d6e3229ff78f051bfbaae83653 Mon Sep 17 00:00:00 2001
From: L4168 <L4168@student.jamk.fi>
Date: Thu, 27 Jun 2019 13:53:18 +0300
Subject: [PATCH] fixed undefined id bug

---
 src/shared/roles.guard.ts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/shared/roles.guard.ts b/src/shared/roles.guard.ts
index e65916a..73693f9 100644
--- a/src/shared/roles.guard.ts
+++ b/src/shared/roles.guard.ts
@@ -32,9 +32,9 @@ export class RolesGuard implements CanActivate {
       return false;
     }
     const gameId = request.params.id;
-    const user = await this.getUserObject(request.headers.authorization);
+    request.user = await this.getUserObject(request.headers.authorization);
     const role = await this.game_PersonRepository.findOne({
-      person: user['id'],
+      person: request.user['id'],
       game: gameId,
     });
     // check that the role matches the criteria and that token is valid for this game
-- 
GitLab