linotp.controllers.tools module¶
tools controller
- class linotp.controllers.tools.ToolsController(name, install_name='', **kwargs)¶
Bases:
BaseController- after_request_funcs: t.Dict[ft.AppOrBlueprintKey, t.List[ft.AfterRequestCallable]]¶
A data structure of functions to call at the end of each request, in the format
{scope: [functions]}. Thescopekey is the name of a blueprint the functions are active for, orNonefor all requests.To register a function, use the
after_request()decorator.This data structure is internal. It should not be modified directly and its format may change at any time.
- before_request_funcs: t.Dict[ft.AppOrBlueprintKey, t.List[ft.BeforeRequestCallable]]¶
A data structure of functions to call at the beginning of each request, in the format
{scope: [functions]}. Thescopekey is the name of a blueprint the functions are active for, orNonefor all requests.To register a function, use the
before_request()decorator.This data structure is internal. It should not be modified directly and its format may change at any time.
- deferred_functions: t.List[DeferredSetupFunction]¶
- error_handler_spec: t.Dict[ft.AppOrBlueprintKey, t.Dict[t.Optional[int], t.Dict[t.Type[Exception], ft.ErrorHandlerCallable]]]¶
A data structure of registered error handlers, in the format
{scope: {code: {class: handler}}}. Thescopekey is the name of a blueprint the handlers are active for, orNonefor all requests. Thecodekey is the HTTP status code forHTTPException, orNonefor other exceptions. The innermost dictionary maps exception classes to handler functions.To register an error handler, use the
errorhandler()decorator.This data structure is internal. It should not be modified directly and its format may change at any time.
- import_users()¶
POST /tools/import_users
import users from a csv file into an dedicated sql resolver
- Parameters:
file – the file containing the users
resolver – the resolver where the users should belong to
dryrun – only test a test run without real import of the users
format – the import file format ‘csv’ or ‘password’
skip_header – in case of a csv file the first line might contain a description of the columns and could be skiped
passwords_in_plaintext – bool - should the passwords be hashed?
column_mapping – in case of the csv, define the meaning of the colums
delimiter – in case of csv define the colum delimiter
quotechar – define how text is quoted
- Returns:
a json result with a boolean status and request result
- Raises:
Exception – if an error occurs an exception is serialized and returned
- migrate_resolver()¶
POST /tools/migrate_resolver
migrate all users and their token into a new resolver
- Raises:
Exception: _description_
- Returns:
a json result with a boolean status and request result
- Raises:
Exception – if an error occurs an exception is serialized and returned
- name: str¶
- setPassword()¶
POST /tools/setPassword
abilty to set password in managed / admin_user resolver
- Parameters:
old_password – the old password
new_password – the new password
- Returns:
a json result with a boolean status and request result
- Raises:
Exception – if an error occurs an exception is serialized and returned
- teardown_request_funcs: t.Dict[ft.AppOrBlueprintKey, t.List[ft.TeardownCallable]]¶
A data structure of functions to call at the end of each request even if an exception is raised, in the format
{scope: [functions]}. Thescopekey is the name of a blueprint the functions are active for, orNonefor all requests.To register a function, use the
teardown_request()decorator.This data structure is internal. It should not be modified directly and its format may change at any time.
- template_context_processors: t.Dict[ft.AppOrBlueprintKey, t.List[ft.TemplateContextProcessorCallable]]¶
A data structure of functions to call to pass extra context values when rendering templates, in the format
{scope: [functions]}. Thescopekey is the name of a blueprint the functions are active for, orNonefor all requests.To register a function, use the
context_processor()decorator.This data structure is internal. It should not be modified directly and its format may change at any time.
- url_default_functions: t.Dict[ft.AppOrBlueprintKey, t.List[ft.URLDefaultCallable]]¶
A data structure of functions to call to modify the keyword arguments when generating URLs, in the format
{scope: [functions]}. Thescopekey is the name of a blueprint the functions are active for, orNonefor all requests.To register a function, use the
url_defaults()decorator.This data structure is internal. It should not be modified directly and its format may change at any time.
- url_value_preprocessors: t.Dict[ft.AppOrBlueprintKey, t.List[ft.URLValuePreprocessorCallable]]¶
A data structure of functions to call to modify the keyword arguments passed to the view function, in the format
{scope: [functions]}. Thescopekey is the name of a blueprint the functions are active for, orNonefor all requests.To register a function, use the
url_value_preprocessor()decorator.This data structure is internal. It should not be modified directly and its format may change at any time.
- view_functions: t.Dict[str, t.Callable]¶
A dictionary mapping endpoint names to view functions.
To register a view function, use the
route()decorator.This data structure is internal. It should not be modified directly and its format may change at any time.