From 728b37080d8bcb5cefdaa5bc4c4ba041c9ee6517 Mon Sep 17 00:00:00 2001
From: Jure Bajic <jure.bajic@memgraph.com>
Date: Mon, 24 Jan 2022 14:35:59 +0100
Subject: [PATCH] Fix authorization check (#332)

---
 src/communication/websocket/session.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/communication/websocket/session.cpp b/src/communication/websocket/session.cpp
index fc56688eb..376668d62 100644
--- a/src/communication/websocket/session.cpp
+++ b/src/communication/websocket/session.cpp
@@ -119,7 +119,7 @@ utils::BasicResult<std::string> Session::Authorize(const nlohmann::json &creds)
     return {"Authentication failed!"};
   }
 #ifdef MG_ENTERPRISE
-  if (auth_.HasUserPermission(creds.at("username").get<std::string>(), auth::Permission::WEBSOCKET)) {
+  if (!auth_.HasUserPermission(creds.at("username").get<std::string>(), auth::Permission::WEBSOCKET)) {
     return {"Authorization failed!"};
   }
 #endif