Compare commits
No commits in common. "83d74c2b069fad58f69043a65736be55d8eefb81" and "6a27b002ffa4676d3a807092ff7b10f2ded3fe54" have entirely different histories.
83d74c2b06
...
6a27b002ff
|
@ -48,31 +48,6 @@ class Controller:
|
|||
**kwargs,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
async def check_role(self,
|
||||
uri: str,
|
||||
username: str,
|
||||
**kwargs: dict,
|
||||
) -> None:
|
||||
# create a new config
|
||||
async with await Config(dispatcher.option) as config:
|
||||
await config.property.read_write()
|
||||
await config.option('message').value.set(uri)
|
||||
subconfig = config.option(uri)
|
||||
for key, value in kwargs.items():
|
||||
try:
|
||||
await subconfig.option(key).value.set(value)
|
||||
except AttributeError:
|
||||
if get_config()['global']['debug']:
|
||||
print_exc()
|
||||
raise ValueError(_(f'unknown parameter in "{uri}": "{key}"'))
|
||||
except ValueOptionError as err:
|
||||
raise ValueError(_(f'invalid parameter in "{uri}": {err}'))
|
||||
await dispatcher.check_role(subconfig,
|
||||
username,
|
||||
uri,
|
||||
)
|
||||
|
||||
async def on_join(self,
|
||||
risotto_context,
|
||||
):
|
||||
|
|
|
@ -333,7 +333,7 @@ class Dispatcher(register.RegisterDispatcher,
|
|||
parameters = await subconfig.value.dict()
|
||||
if extra_parameters:
|
||||
parameters.update(extra_parameters)
|
||||
return parameters
|
||||
return parameters
|
||||
|
||||
def get_service(self,
|
||||
name: str):
|
||||
|
@ -342,8 +342,7 @@ class Dispatcher(register.RegisterDispatcher,
|
|||
async def check_role(self,
|
||||
config: Config,
|
||||
user_login: str,
|
||||
uri: str,
|
||||
) -> None:
|
||||
uri: str) -> None:
|
||||
async with self.pool.acquire() as connection:
|
||||
async with connection.transaction():
|
||||
# Verify if user exists and get ID
|
||||
|
|
Loading…
Reference in New Issue