Added can see check #378

This commit is contained in:
Sven Heidemann 2023-09-28 10:54:04 +02:00
parent 4161d3a38a
commit 4c0a4bc1ae

View File

@ -20,6 +20,7 @@ from bot_data.model.known_user import KnownUser
from bot_data.model.level import Level
from bot_data.model.server import Server
from bot_data.model.server_config import ServerConfig
from bot_data.model.short_role_name import ShortRoleName
from bot_data.model.user import User
from bot_data.model.user_joined_game_server import UserJoinedGameServer
from bot_data.model.user_joined_server import UserJoinedServer
@ -184,6 +185,16 @@ class QueryABC(ObjectType):
access = True
break
elif type(element) == ShortRoleName:
element: ShortRoleName = 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) == dict and "key" in element and element["key"] in [e.value for e in FeatureFlagsEnum]:
for u in user.users:
u: User = u