Source code for

from galaxy import exceptions as glx_exceptions
from galaxy.managers.context import ProvidesUserContext
from galaxy.managers.users import UserManager
from galaxy.queue_worker import send_local_control_task
from import IdEncodingHelper
from import ServiceBase

[docs]class UsersService(ServiceBase): """Common interface/service logic for interactions with users in the context of the API. Provides the logic of the actions invoked by API controllers and uses type definitions and pydantic models to declare its parameters and return types. """
[docs] def __init__( self, security: IdEncodingHelper, user_manager: UserManager, ): super().__init__(security) self.user_manager = user_manager
[docs] def recalculate_disk_usage( self, trans: ProvidesUserContext, ): if trans.anonymous: raise glx_exceptions.AuthenticationRequired("Only registered users can recalculate disk usage.") if from galaxy.celery.tasks import recalculate_user_disk_usage recalculate_user_disk_usage.delay( else: send_local_control_task(, "recalculate_user_disk_usage", kwargs={"user_id": self.encode_id(}, )