From 87b277515c431d1345cf3d6c2e16ed1b2ad5a85c Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Fri, 24 Mar 2023 14:23:13 +0100 Subject: [PATCH] Fixed permission handling for member data #256 --- kdb-bot/src/bot_graphql/abc/query_abc.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/kdb-bot/src/bot_graphql/abc/query_abc.py b/kdb-bot/src/bot_graphql/abc/query_abc.py index 028678f6..75d2d580 100644 --- a/kdb-bot/src/bot_graphql/abc/query_abc.py +++ b/kdb-bot/src/bot_graphql/abc/query_abc.py @@ -124,28 +124,36 @@ class QueryABC(ObjectType): elif type(element) == User: for u in user.users: u: User = u - if u.id == element.id: + guild = bot.get_guild(u.server.discord_id) + member = guild.get_member(u.discord_id) + if u.id == element.id or permissions.is_member_moderator(member): access = True break elif type(element) == UserJoinedServer: for u in user.users: u: User = u - if u.id == element.user.id: + guild = bot.get_guild(u.server.discord_id) + member = guild.get_member(u.discord_id) + if u.id == element.id or permissions.is_member_moderator(member): access = True break elif type(element) == UserJoinedVoiceChannel: for u in user.users: u: User = u - if u.id == element.user.id: + guild = bot.get_guild(u.server.discord_id) + member = guild.get_member(u.discord_id) + if u.id == element.id or permissions.is_member_moderator(member): access = True break elif type(element) == UserJoinedGameServer: for u in user.users: u: User = u - if u.id == element.user.id: + guild = bot.get_guild(u.server.discord_id) + member = guild.get_member(u.discord_id) + if u.id == element.id or permissions.is_member_moderator(member): access = True break -- 2.45.2