magpie.helpers.register_default_users¶
Module Contents¶
-
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_USERandMAGPIE_ANONYMOUS_GROUPrespectively 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_USERandMAGPIE_ADMIN_GROUPrespectively if not defined.Also associates the created admin user with the admin group and give it admin permissions.