From 8255f2be68569a1d4402273b0c6e5827afbd2899 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Mon, 21 Aug 2023 20:06:49 +0200 Subject: [PATCH] Fixed can user see element for achievements #1.1.1 --- kdb-bot/src/bot_graphql/abc/query_abc.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/kdb-bot/src/bot_graphql/abc/query_abc.py b/kdb-bot/src/bot_graphql/abc/query_abc.py index 22db1896..67692585 100644 --- a/kdb-bot/src/bot_graphql/abc/query_abc.py +++ b/kdb-bot/src/bot_graphql/abc/query_abc.py @@ -10,6 +10,7 @@ from bot_api.exception.service_error_code_enum import ServiceErrorCode from bot_api.exception.service_exception import ServiceException from bot_api.route.route import Route from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum +from bot_data.model.achievement import Achievement from bot_data.model.auth_role_enum import AuthRoleEnum from bot_data.model.auth_user import AuthUser from bot_data.model.auto_role import AutoRole @@ -78,7 +79,17 @@ class QueryABC(ObjectType): bot: DiscordBotServiceABC = services.get_service(DiscordBotServiceABC) access = False - if type(element) == AutoRole: + if type(element) == Achievement: + element: Achievement = element + for u in user.users: + u: User = u + guild = bot.get_guild(u.server.discord_id) + member = guild.get_member(u.discord_id) + if permissions.is_member_moderator(member) and u.server.id == element.server.id: + access = True + break + + elif type(element) == AutoRole: element: AutoRole = element for u in user.users: u: User = u