Package webinterface

webinterface.common

common.py

Helper functions for the graphical user interface of mercure.

async webinterface.common.async_run(cmd, **params) Tuple[Optional[int], bytes, bytes][source]

Executes the given command in a way compatible with ayncio.

async webinterface.common.async_run_exec(*args, **params) Tuple[Optional[int], bytes, bytes][source]

Executes the given command in a way compatible with ayncio.

webinterface.common.get_user_information(request) dict[source]

Returns dictionary of values that should always be passed to the templates when the user is logged in.

webinterface.modules

modules.py

Modules page for the graphical user interface of mercure.

class webinterface.modules.BadRequestResponse(*args)[source]

Bases: PlainTextResponse

class webinterface.modules.ServerErrorResponse(*args)[source]

Bases: PlainTextResponse

async webinterface.modules.add_module(request)[source]

Creates a new module and forwards the user to the module edit page.

async webinterface.modules.delete_module(request)[source]

Deletes the module with the given module name.

async webinterface.modules.edit_module(request)[source]

Show the module edit page for the given module name.

async webinterface.modules.edit_module_POST(request)[source]

Save the settings for the given module name.

async webinterface.modules.save_module(form, name) None[source]

Save the settings for the module with the given name.

async webinterface.modules.show_modules(request)[source]

Shows all installed modules

webinterface.queue

queue.py

Queue page for the graphical user interface of mercure.

async webinterface.queue.force_study_complete(request)[source]
async webinterface.queue.get_jobinfo(request)[source]
async webinterface.queue.set_queues_status(request)[source]
async webinterface.queue.show_jobs_fail(request)[source]
async webinterface.queue.show_jobs_processing(request)[source]
async webinterface.queue.show_jobs_routing(request)[source]
async webinterface.queue.show_jobs_studies(request)[source]
async webinterface.queue.show_queues(request)[source]

Shows all installed modules

async webinterface.queue.show_queues_status(request)[source]

webinterface.rules

rules.py

Rules page for the graphical user interface of mercure.

async webinterface.rules.add_rule(request) Response[source]

Creates a new routing rule and forwards the user to the rule edit page.

async webinterface.rules.rules_delete_post(request) Response[source]

Deletes the given routing rule

async webinterface.rules.rules_edit(request) Response[source]

Shows the edit page for the given routing rule.

async webinterface.rules.rules_edit_post(request) Response[source]

Updates the settings for the given routing rule.

async webinterface.rules.rules_test(request) Response[source]

Evalutes if a given routing rule is valid. The rule and testing dictionary have to be passed as form parameters.

async webinterface.rules.rules_test_completionseries(request) Response[source]

Evalutes if a given value for the series list for study completion is valid.

async webinterface.rules.show_rules(request) Response[source]

Show all defined routing rules. Can be executed by all logged-in users.

webinterface.services

services.py

Helper functions for controlling the services from the graphical user interface of mercure.

webinterface.services.read_services() None[source]

Reads the list of configured services from the configuration file. This list normally does not have to be changed, but can be modified if multiple instances of individual services should be used to increase performance.

webinterface.targets

targets.py

Targets page for the graphical user interface of mercure.

async webinterface.targets.add_target(request) Response[source]

Creates a new target.

async webinterface.targets.show_targets(request) Response[source]

Shows all configured targets.

async webinterface.targets.targets_delete_post(request) Response[source]

Deletes the given target.

async webinterface.targets.targets_edit(request) Response[source]

Shows the edit page for the given target.

async webinterface.targets.targets_edit_post(request) Union[RedirectResponse, PlainTextResponse][source]

Updates the given target using the form values posted with the request.

async webinterface.targets.targets_test_post(request) Response[source]

Tests the connectivity of the given target by executing ping and c-echo requests.

webinterface.users

users.py

Users page and user support functions for the graphical user interface of mercure.

class webinterface.users.User(*args, **kwargs)[source]

Bases: dict

change_password: typing_extensions.Literal[True, False]
email: str
is_admin: typing_extensions.Literal[True, False]
password: str
permissions: Any
async webinterface.users.add_new_user(request) Response[source]

Creates a new user and redirects to the user-edit page.

webinterface.users.create_users() Dict[str, User][source]

Create new users file and create seed admin account with name “admin” and password “router”.

webinterface.users.evaluate_password(username, password) bool[source]

Check if the given password for the given user is correct. Hashed passwords are stored with salt.

webinterface.users.hash_password(password) str[source]

Hash the password using the passlib library.

webinterface.users.is_admin(username) bool[source]

Check in the user list if the given user has admin rights.

webinterface.users.needs_change_password(username) bool[source]

Check if the given user has to change his password after login.

webinterface.users.read_users() Dict[str, User][source]

Reads the user list from the configuration file. The file will only be read if it has been updated since the last function call. If the file does not exist, create a new user file.

webinterface.users.save_users() None[source]

Write the users list into a file on the disk.

async webinterface.users.show_users(request) Response[source]

Shows all available users.

async webinterface.users.users_delete_post(request) Response[source]

Deletes the given users.

async webinterface.users.users_edit(request) Response[source]

Shows the settings for a given user.

async webinterface.users.users_edit_post(request) Response[source]

Updates the given user with settings passed as form parameters.