magpie.helpers.register_default_users

Module Contents

magpie.helpers.register_default_users.LOGGER[source]
magpie.helpers.register_default_users.register_user_with_group(user_name, group_name, email, password, db_session) → None[source]

Registers the user if missing and associate him to a group specified by name, also created if missing.

Parameters:
  • user_name – name of the user to create (if missing) and to make part of the group (if specified)
  • group_name – name of the group to create (if missing and specified) and to make the user join (if not already)
  • email – email of the user to be created (if missing)
  • password – password of the user to be created (if missing)
  • db_session – database connexion to apply changes

Warning

Should be employed only for special users/groups in this module as other expected API behaviour and operations will not be applied (ex: create additional permissions or user-group references).

magpie.helpers.register_default_users.init_anonymous(db_session, settings=None) → None[source]

Registers in db the user and group matching MAGPIE_ANONYMOUS_USER and MAGPIE_ANONYMOUS_GROUP respectively if not defined.

magpie.helpers.register_default_users.init_admin(db_session, settings=None) → None[source]

Registers in db the user and group matching MAGPIE_ADMIN_USER and MAGPIE_ADMIN_GROUP respectively if not defined.

Also associates the created admin user with the admin group and give it admin permissions.

magpie.helpers.register_default_users.init_users_group(db_session, settings=None) → None[source]

Registers in db the group matching MAGPIE_USERS_GROUP if not defined.

magpie.helpers.register_default_users.register_default_users(db_session=None, settings=None) → None[source]

Registers in db every undefined default users and groups matching following variables :

  • MAGPIE_ANONYMOUS_USER
  • MAGPIE_USERS_GROUP
  • MAGPIE_ADMIN_GROUP
  • MAGPIE_ADMIN_USER