hawat.blueprints.auth_dev package

Description

This Hawat pluggable module provides special authentication method, that is particularly usable for developers and enables them to impersonate any user.

After enabling this module special authentication endpoint will be available and will provide simple authentication form with list of all currently available user accounts. It will be possible for that user to log in as any other user without entering password.

This module is disabled by default in production environment and enabled by default in development environment.

Warning

This module must never ever be enabled on production systems, because it is a huge security risk and enables possible access control management violation. You have been warned!

Provided endpoints

/auth_dev/login

Page providing special developer login form.

  • Authentication: no authentication

  • Methods: GET, POST

hawat.blueprints.auth_dev.BLUEPRINT_NAME = 'auth_dev'

Name of the blueprint as module global constant.

class hawat.blueprints.auth_dev.DevAuthBlueprint(name, import_name, **kwargs)[source]

Bases: hawat.base.HawatBlueprint

Hawat pluggable module - special developer authentication (auth_dev).

classmethod get_module_title()[source]

Implementation of hawat.base.HawatBlueprint.get_module_title().

register_app(app)[source]

Callback method. Will be called from hawat.base.HawatApp.register_blueprint() method and can be used to customize the Flask application object. Possible use cases:

  • application menu customization

Parameters

app (hawat.base.HawatApp) – Flask application to be customize.

class hawat.blueprints.auth_dev.LoginView[source]

Bases: hawat.base.HTMLMixin, hawat.base.SQLAlchemyMixin, hawat.base.SimpleView

View enabling special developer login.

dbmodel

Implementation of hawat.base.SQLAlchemyMixin.dbmodel().

dispatch_request()[source]

Mandatory interface required by the flask.views.View.dispatch_request(). Will be called by the Flask framework to service the request.

classmethod get_view_icon()[source]

Implementation of hawat.base.BaseView.get_view_icon().

classmethod get_view_name()[source]

Implementation of hawat.base.BaseView.get_view_name().

classmethod get_view_title(**kwargs)[source]

Implementation of hawat.base.BaseView.get_menu_title().

methods = ['GET', 'POST']
class hawat.blueprints.auth_dev.RegisterView[source]

Bases: hawat.base.HTMLMixin, hawat.base.SQLAlchemyMixin, hawat.base.RenderableView

View responsible for registering new user account into application.

changelog_log(item, json_state_before='', json_state_after='')[source]

Log item action into changelog. One of the method arguments is permitted to be left out. This enables logging create and delete actions.

Parameters
  • item (mentat.datatype.sqldb.MODEL) – Item that is being changed.

  • json_state_before (str) – JSON representation of item state before action.

  • json_state_after (str) – JSON representation of item state after action.

dbmodel

Implementation of hawat.base.SQLAlchemyMixin.dbmodel().

dispatch_request()[source]

Mandatory interface required by the flask.views.View.dispatch_request(). Will be called by the Flask framework to service the request.

static get_item_form()[source]

Get user account registration form object.

classmethod get_menu_title(**kwargs)[source]

Implementation of hawat.base.BaseView.get_menu_title().

classmethod get_view_icon()[source]

Implementation of hawat.base.BaseView.get_view_icon().

classmethod get_view_name()[source]

Implementation of hawat.base.BaseView.get_view_name().

classmethod get_view_template()[source]

Return Jinja2 template file that should be used for rendering the view content. This default implementation works only in case the view class was properly registered into the parent blueprint/module with hawat.base.HawatBlueprint.register_view_class() method.

Returns

Jinja2 template file to use to render the view.

Return type

str

classmethod get_view_title(**kwargs)[source]

Implementation of hawat.base.BaseView.get_view_title().

classmethod inform_admins(account, form_data)[source]

Send information about new account registration to system admins. Use default locale for email content translations.

classmethod inform_managers(account, form_data)[source]

Send information about new account registration to the user. Use manager`s locale for email content translations.

classmethod inform_user(account, form_data)[source]

Send information about new account registration to the user. Use user`s locale for email content translations.

methods = ['GET', 'POST']
hawat.blueprints.auth_dev.get_blueprint()[source]

Mandatory interface and factory function. This function must return a valid instance of hawat.base.HawatBlueprint or flask.Blueprint.