websauna.system.user.adminviews module

CRUD views for user and group management.

class websauna.system.user.adminviews.GroupAdd(context, request)[source]

Bases: websauna.system.admin.views.Add

Create new Group.

add()[source]

Group add view..

Returns

Context for template rendering.

form_generator = <websauna.system.crud.formgenerator.SQLAlchemyFormGenerator object>
includes = ['name', 'description']
class websauna.system.user.adminviews.GroupEdit(context, request)[source]

Bases: websauna.system.admin.views.Edit

Edit one group in admin interface.

edit()[source]

Group edit view..

Returns

Context for template rendering.

form_generator = <websauna.system.crud.formgenerator.SQLAlchemyFormGenerator object>
includes = ['name', 'description']
class websauna.system.user.adminviews.GroupListing(context, request)[source]

Bases: websauna.system.admin.views.Listing

Listing view for Groups.

order_query(query)[source]

Add ordering to an existing SQLAlchemy query.

Parameters

query (Query) – Base query.

Return type

Query

Returns

Query ordered by id descending.

table = <websauna.system.crud.listing.Table object>
class websauna.system.user.adminviews.GroupShow(context, request)[source]

Bases: websauna.system.admin.views.Show

Display one Group.

form_generator = <websauna.system.crud.formgenerator.SQLAlchemyFormGenerator object>
includes = ['id', 'name', 'description', 'created_at', 'updated_at']
show()[source]

Group show view..

Returns

Context for template rendering.

class websauna.system.user.adminviews.UserAdd(context, request)[source]

Bases: websauna.system.admin.views.Add

CRUD for creating new users.

form_generator = <websauna.system.crud.formgenerator.SQLAlchemyFormGenerator object>
get_form()[source]

Return the Add form for this view.

Returns

Form object.

includes = [<colander.SchemaNode object at 4454287008 (named email)>, 'full_name', <colander.SchemaNode object at 4454058696 (named password)>, <colander.SchemaNode object at 4454059928 (named groups)>]
initialize_object(form, appstruct, obj)[source]

Initialize User object.

Parameters
  • form (Form) – Form object.

  • appstruct (dict) – Form data.

  • obj (User) – User object.

class websauna.system.user.adminviews.UserCSVListing(context, request)[source]

Bases: websauna.system.crud.views.CSVListing

CSV export of the site users.

order_query(query)[source]

Add ordering to an existing SQLAlchemy query.

Parameters

query (Query) – Base query.

Return type

Query

Returns

Query ordered by created_at.

table = <websauna.system.crud.listing.Table object>
title = 'users-export'
class websauna.system.user.adminviews.UserDelete(context, request)[source]

Bases: websauna.system.admin.views.Delete

Delete user view.

Drop user sessions on invocation.

deleter(context, request)[source]

Execute user deletion.

  • Delete user from database.

  • Remove all user sessions.

Parameters
  • context (Resource) – Traversable resource.

  • request (Request) – Pyramid request.

class websauna.system.user.adminviews.UserEdit(context, request)[source]

Bases: websauna.system.admin.views.Edit

Edit one user in admin interface.

edit()[source]

User edit view.

Returns

Context for template rendering.

form_generator = <websauna.system.crud.formgenerator.SQLAlchemyFormGenerator object>
get_title()[source]

Title for the User object.

Return type

str

Returns

Title for the User object.

includes = ['enabled', <colander.SchemaNode object at 4453904056 (named username)>, <colander.SchemaNode object at 4453901760 (named full_name)>, 'email', <colander.SchemaNode object at 4453901312 (named groups)>]
save_changes(form, appstruct, user)[source]

Save the user edit and reflect if we need to drop user session.

Parameters
  • form (Form) – Form object.

  • appstruct (dict) – Form data.

  • user (User) – User object.

class websauna.system.user.adminviews.UserListing(context, request)[source]

Bases: websauna.system.admin.views.Listing

Listing view for Users.

listing()[source]

User listing view.

Return type

dict

Returns

Context for template rendering.

order_query(query)[source]

Add ordering to an existing SQLAlchemy query.

Parameters

query (Query) – Base query.

Return type

Query

Returns

Query ordered by created_at.

resource_buttons = [<websauna.system.crud.views.TraverseLinkButton object>, <websauna.system.crud.views.TraverseLinkButton object>]
table = <websauna.system.crud.listing.Table object>
title = 'All users'
class websauna.system.user.adminviews.UserSetPassword(context, request)[source]

Bases: websauna.system.admin.views.Edit

Set the user password.

Use the CRUD edit form with one field to set the user password.

do_success()[source]

After password change, redirect user.

Return type

Response

Returns

Redirect user.

form_generator = <websauna.system.crud.formgenerator.SQLAlchemyFormGenerator object>
includes = [<colander.SchemaNode object at 4454058304 (named password)>]
save_changes(form, appstruct, obj)[source]

Save the form data.

Parameters
  • form (Form) – Form object.

  • appstruct (dict) – Form data.

  • user – User object.

set_password()[source]

User set password view.

Returns

Context for template rendering.

class websauna.system.user.adminviews.UserShow(context, request)[source]

Bases: websauna.system.admin.views.Show

Show one user.

form_generator = <websauna.system.crud.formgenerator.SQLAlchemyFormGenerator object>
get_title()[source]

Title for the User object.

Return type

str

Returns

Title for the User object.

includes = ['id', 'uuid', 'enabled', 'created_at', 'updated_at', 'username', <colander.SchemaNode object at 4453902600 (named full_name)>, 'email', 'last_login_at', 'last_login_ip', <colander.SchemaNode object at 4453901704 (named registration_source)>, <colander.SchemaNode object at 4453900696 (named user_data)>, <colander.SchemaNode object at 4453902152 (named groups)>]
resource_buttons = [<websauna.system.crud.views.TraverseLinkButton object>, <websauna.system.crud.views.TraverseLinkButton object>, <websauna.system.crud.views.TraverseLinkButton object>, <websauna.system.crud.views.TraverseLinkButton object>]
show()[source]

User show view.

Returns

Context for template rendering.

websauna.system.user.adminviews.kill_user_sessions(request, user, operation)[source]

Notify session to drop this user.

Parameters
  • request (Request) – Pyramid request.

  • user (InterfaceClass) – User.

  • operation (str) – Operation triggering the killing of user sessions.

websauna.system.user.adminviews.user_admin_panel(context, request, **kwargs)[source]

Admin panel for Users.

Parameters
  • context (UserAdmin) – Model admin.

  • request (Request) – Pyramid request.

  • kwargs – Additional context to be passed to the panel.

Return type

dict

Returns

Context for template rendering.