From c06a8f2265568d4bfa8c968db672f703f1f79003 Mon Sep 17 00:00:00 2001 From: Layla Manley Date: Sun, 8 Oct 2023 04:56:10 -0400 Subject: [PATCH] iteration --- lib/auth.lua | 12 ++++++------ packages/auth_server.lua | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/auth.lua b/lib/auth.lua index 4ea0b63..1ad898d 100644 --- a/lib/auth.lua +++ b/lib/auth.lua @@ -102,20 +102,20 @@ function add_user_to_group(username, group) if id == auth_server_id then if msg == "invalid request" then io.write("Invalid request\n") - return + return false elseif msg == "user not found" then io.write("User not found\n") - return + return false elseif msg == "invalid token" then io.write("Invalid token\n") - return + return false elseif msg == "invalid privileges" then io.write("Invalid privileges\n") - return + return false elseif msg == "ok" then - return + return true else - return + return false end end end diff --git a/packages/auth_server.lua b/packages/auth_server.lua index 89cae8c..5d118ba 100644 --- a/packages/auth_server.lua +++ b/packages/auth_server.lua @@ -199,7 +199,7 @@ while true do if not found then rednet.send(client_id, "invalid token", "auth") - elseif data.users[acting_user].groups["admin"] == nil then + elseif data.users[acting_user]["groups"] ~= nil or data.users[acting_user].groups["admin"] == nil then rednet.send(client_id, "invalid privileges", "auth") else if data.users[request.username].groups == nil then