endi.views.user package¶
Submodules¶
endi.views.user.company module¶
- class endi.views.user.company.CompanyAssociationView(context, request=None)¶
Bases :
BaseFormViewAssociate a user with a company
- property current_user¶
- dbsession: DBSESSION¶
- request: Request¶
- schema = <colander.Schema object at 140624058496144 (named )>¶
Colander schema instance to be used to create the form instance. Provide your schema in your derived class.
- session: ISession¶
- submit_success(appstruct)¶
- title = 'Associer un utilisateur à une ou plusieurs enseigne(s)'¶
- class endi.views.user.company.UserCompaniesView(context, request=None)¶
Bases :
BaseViewCollect datas for the company display view
- property current_user¶
- title = "Enseignes de l'utilisateur"¶
- endi.views.user.company.add_routes(config)¶
- endi.views.user.company.add_views(config)¶
- endi.views.user.company.includeme(config)¶
endi.views.user.connections module¶
User connections listing views
- class endi.views.user.connections.UserConnectionsListView(*args, **kwargs)¶
Bases :
BaseListView- dbsession: DBSESSION¶
- default_sort = 'lastname'¶
- filter_month(query, appstruct)¶
- filter_year(query, appstruct)¶
- more_template_vars(response_dict)¶
Add template datas in the response dictionnary
Used to populate an actionmenu (if there’s one in the page) actionmenu is a request attribute used to automate the integration of actionmenus in pages
- query()¶
Return the main query for our list view
- request: Request¶
- schema = <endi.forms.lists.BaseListsSchema object at 140624057653072 (named )>¶
- session: ISession¶
- sort_columns = {'email': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'firstname': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'lastname': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'month_last_connection': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}¶
- title = 'Historique des connexions utilisateurs'¶
- endi.views.user.connections.includeme(config)¶
Pyramid module entry point
- Paramètres:
config (obj) – The pyramid configuration object
endi.views.user.layout module¶
- class endi.views.user.layout.UserLayout(context, request)¶
Bases :
DefaultLayoutLayout for user related pages Provide the main page structure for user view
- endi.views.user.layout.deferred_accounting_show_perm(item, kw)¶
- endi.views.user.layout.deferred_enterprise_label(item, kw)¶
Collect a custom label for the « Enseignes » menu entry using binding parameters
- endi.views.user.layout.deferred_login_label(item, kw)¶
Custom deferred label for the login sidebar entry
- endi.views.user.layout.includeme(config)¶
endi.views.user.lists module¶
User and user datas listing views
- class endi.views.user.lists.BaseUserListView(*args, **kwargs)¶
Bases :
BaseListViewBase list for the User model Provide :
The base User class query The filtering on the search field The filtering on the company activity_id
add filters to specify more specific list views (e.g: trainers, users with account …)
- add_template_vars = ('stream_actions',)¶
- dbsession: DBSESSION¶
- filter_activity_id(query, appstruct)¶
- filter_name_search(query, appstruct)¶
- filter_user_group(query, appstruct)¶
- query()¶
The main query, should be overrided by a subclass
- request: Request¶
- schema = None¶
- session: ISession¶
- sort_columns = {'email': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}¶
- stream_actions(item)¶
Compile the action description for the given item
- title = 'Tous les comptes'¶
- class endi.views.user.lists.GeneralAccountList(*args, **kwargs)¶
Bases :
BaseUserListViewList the User models with Login attached to them
- dbsession: DBSESSION¶
- filter_login_filter(query, appstruct)¶
Filter the list on accounts with login only
- request: Request¶
- schema = <endi.forms.lists.BaseListsSchema object at 140624060330576 (named )>¶
- session: ISession¶
- sort_columns = {'email': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}¶
- title = 'Annuaire des utilisateurs'¶
- endi.views.user.lists.includeme(config)¶
Pyramid module entry point
- Paramètres:
config (obj) – The pyramid configuration object
endi.views.user.login module¶
- class endi.views.user.login.LoginAddView(*args, **kwargs)¶
Bases :
BaseFormViewView handling login add
- before(form)¶
Performs some processing on the
formprior to rendering.By default, this method does nothing. Override this method in your dervived class to modify the
form. Your function will be executed immediately after instansiating the form instance in__call__()(thus before obtaining widget resources, considering buttons, or rendering).
- dbsession: DBSESSION¶
- request: Request¶
- schema = <colanderalchemy.schema.SQLAlchemySchemaNode object at 140624059942352 (named )>¶
Colander schema instance to be used to create the form instance. Provide your schema in your derived class.
- session: ISession¶
- submit_success(appstruct)¶
- property title¶
- class endi.views.user.login.LoginDeleteView(context, request=None)¶
Bases :
DeleteView- dbsession: DBSESSION¶
- delete_msg = 'Les identifiants ont bien été supprimés'¶
- redirect()¶
- request: Request¶
- session: ISession¶
- class endi.views.user.login.LoginDisableView(context, request=None)¶
Bases :
DisableView- dbsession: DBSESSION¶
- on_disable()¶
- redirect()¶
- request: Request¶
- session: ISession¶
- class endi.views.user.login.LoginEditView(context, request=None)¶
Bases :
BaseFormView- before(form)¶
Performs some processing on the
formprior to rendering.By default, this method does nothing. Override this method in your dervived class to modify the
form. Your function will be executed immediately after instansiating the form instance in__call__()(thus before obtaining widget resources, considering buttons, or rendering).
- current()¶
- dbsession: DBSESSION¶
- is_my_account_view()¶
- request: Request¶
- schema = <colanderalchemy.schema.SQLAlchemySchemaNode object at 140624056078096 (named )>¶
Colander schema instance to be used to create the form instance. Provide your schema in your derived class.
- session: ISession¶
- submit_success(appstruct)¶
- property title¶
- class endi.views.user.login.LoginPasswordView(context, request=None)¶
Bases :
LoginEditViewChanger mon mot de passe
- dbsession: DBSESSION¶
- request: Request¶
- schema = <colanderalchemy.schema.SQLAlchemySchemaNode object at 140624056077008 (named )>¶
Colander schema instance to be used to create the form instance. Provide your schema in your derived class.
- session: ISession¶
- property title¶
- class endi.views.user.login.UserLoginEditView(context, request=None)¶
Bases :
LoginEditView- current()¶
- dbsession: DBSESSION¶
- request: Request¶
- schema = <colanderalchemy.schema.SQLAlchemySchemaNode object at 140624057701840 (named )>¶
Colander schema instance to be used to create the form instance. Provide your schema in your derived class.
- session: ISession¶
- class endi.views.user.login.UserLoginPasswordView(context, request=None)¶
Bases :
UserLoginEditView- dbsession: DBSESSION¶
- request: Request¶
- schema = <colanderalchemy.schema.SQLAlchemySchemaNode object at 140624057765776 (named )>¶
Colander schema instance to be used to create the form instance. Provide your schema in your derived class.
- session: ISession¶
- property title¶
- endi.views.user.login.includeme(config)¶
- endi.views.user.login.login_view(context, request)¶
Return the login view datas
endi.views.user.rest_api module¶
Users rest api
Used to get active users list from externals tools
- class endi.views.user.rest_api.UsersListRestView(*args, **kwargs)¶
Bases :
BaseRestViewHandle requests for active users list expect json body with {“period”: [{« year »: « YYYY », « month »: « MM »}]}
Respond to a Http GET request
Setting endi.users_api_key=06dda91136f6ad4688cdf6c8fd991696 in the development.ini
>>> def list_active_users(params=None): ... import time ... import requests ... from hashlib import md5 ... timestamp = str(time.time()) ... api_key = "06dda91136f6ad4688cdf6c8fd991696" ... secret = "%s-%s" % (timestamp, api_key) ... encoded = md5(secret.encode('utf-8')).hexdigest() ... url = "http://127.0.0.1:8080/api/v1/users/list" ... headers = { ... "Authorization" : "HMAC-MD5 %s" % encoded, ... "Timestamp": timestamp ... } ... resp = requests.get(url, json=params, headers=headers) ... return resp >>> resp = list_active_users({'period': [{"year": "2019", "month": "6"}]}) >>> print resp.json()
- Renvoie:
List of enDI’s active users group by month
- dbsession: DBSESSION¶
- get_active_users()¶
- request: Request¶
- session: ISession¶
- endi.views.user.rest_api.authentification_check_view(context, request)¶
Allows to chek if the accounting authentication is valid without firing any additionnal action
- endi.views.user.rest_api.includeme(config)¶
endi.views.user.routes module¶
- endi.views.user.routes.includeme(config)¶
endi.views.user.tools module¶
endi.views.user.user module¶
User Related views
- class endi.views.user.user.UserAccountEditView(context, request=None)¶
Bases :
BaseEditViewView allowing a end user to modify some of his account informations
- dbsession: DBSESSION¶
- get_default_appstruct()¶
Collect datas that will initially populate the form
- merge_appstruct(appstruct, model)¶
Merge the appstruct with current model
- Paramètres:
appstruct (dict) – Validated form datas
model (obj) – A new instance of the object we create
- Renvoie:
The model this view is supposed to add
- msg = 'Vos modifications ont bien été enregistrées'¶
- on_edit(appstruct, model)¶
Hook launched before the session is flushed
- redirect(appstruct)¶
- request: Request¶
- schema = <colanderalchemy.schema.SQLAlchemySchemaNode object at 140624053905424 (named )>¶
Colander schema instance to be used to create the form instance. Provide your schema in your derived class.
- session: ISession¶
- title = 'Modifier mes informations'¶
- class endi.views.user.user.UserAccountingEditView(context, request=None)¶
Bases :
BaseEditView- dbsession: DBSESSION¶
- redirect(appstruct)¶
- request: Request¶
- schema = <colanderalchemy.schema.SQLAlchemySchemaNode object at 140624054000208 (named )>¶
Colander schema instance to be used to create the form instance. Provide your schema in your derived class.
- session: ISession¶
- title = 'Configuration des informations comptables'¶
- class endi.views.user.user.UserAddView(*args, **kwargs)¶
Bases :
BaseFormViewview handling user add, also check for existing similar accounts
- before(form)¶
Performs some processing on the
formprior to rendering.By default, this method does nothing. Override this method in your dervived class to modify the
form. Your function will be executed immediately after instansiating the form instance in__call__()(thus before obtaining widget resources, considering buttons, or rendering).
- dbsession: DBSESSION¶
- query_homonym(lastname, email)¶
collect the accounts with same name or email
- request: Request¶
- schema = <colanderalchemy.schema.SQLAlchemySchemaNode object at 140624056175056 (named )>¶
Colander schema instance to be used to create the form instance. Provide your schema in your derived class.
- session: ISession¶
- submit_success(appstruct)¶
Handle successfull form submission
- Paramètres:
appstruct (dict) – The submitted datas
- title = 'Ajouter un compte'¶
- class endi.views.user.user.UserDeleteView(context, request=None)¶
Bases :
DeleteView- dbsession: DBSESSION¶
- redirect_route = '/users'¶
- request: Request¶
- session: ISession¶
- class endi.views.user.user.UserEditView(context, request=None)¶
Bases :
UserAccountEditView- dbsession: DBSESSION¶
- request: Request¶
- schema = <colanderalchemy.schema.SQLAlchemySchemaNode object at 140624053906000 (named )>¶
Colander schema instance to be used to create the form instance. Provide your schema in your derived class.
- session: ISession¶
- title = "Modifier les informations de l'utilisateur"¶
- endi.views.user.user.includeme(config)¶
Add module related views
- endi.views.user.user.user_add_manager_entry_point(context, request)¶
Entry point for manager user add Prepare the form configuration
- The add process follows this stream :
1- entry point 2- user add form 3- login add form
- endi.views.user.user.user_view(context, request)¶
Collect datas for the user view
Module contents¶
- endi.views.user.includeme(config)¶