support into master #371
@ -9,6 +9,8 @@ from cpl_discord.service import DiscordBotServiceABC
|
||||
from flask import request
|
||||
|
||||
from bot_api.configuration.authentication_settings import AuthenticationSettings
|
||||
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
||||
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
||||
from bot_data.abc.api_key_repository_abc import ApiKeyRepositoryABC
|
||||
from bot_data.abc.game_server_repository_abc import GameServerRepositoryABC
|
||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||
@ -77,6 +79,11 @@ class UserJoinedGameServerMutation(QueryABC):
|
||||
def resolve_user_joined(self, *_, input: dict):
|
||||
game_ident = self._user_game_idents.get_user_game_ident_by_ident(input["ident"])
|
||||
user = game_ident.user
|
||||
|
||||
settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{user.server.discord_id}")
|
||||
if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.game_server):
|
||||
raise Exception("Feature not activated")
|
||||
|
||||
self._can_user_mutate_data(user.server, UserRoleEnum.admin)
|
||||
|
||||
active = self._user_joined_game_servers.find_active_user_joined_game_server_by_user_id(user.id)
|
||||
@ -98,6 +105,11 @@ class UserJoinedGameServerMutation(QueryABC):
|
||||
if game_ident is None:
|
||||
return
|
||||
user = game_ident.user
|
||||
|
||||
settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{user.server.discord_id}")
|
||||
if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.game_server):
|
||||
raise Exception("Feature not activated")
|
||||
|
||||
self._can_user_mutate_data(user.server, UserRoleEnum.admin)
|
||||
|
||||
active = self._user_joined_game_servers.find_active_user_joined_game_server_by_user_id(user.id)
|
||||
|
Loading…
Reference in New Issue
Block a user