magpie.cli.register_defaults
¶
Magpie helpers for user and group registration.
Module Contents¶
Functions¶
|
Registers the user if missing and associate him to a group specified by name, also created if missing. |
|
Registers into the database the user and group matching configuration values of. |
|
Registers into the database the user and group matching configuration values of. |
|
Registers into database the group matching |
|
Registers into database every undefined default users and groups matching following variables: |
|
|
|
-
magpie.cli.register_defaults.
register_user_with_group
(user_name: magpie.typedefs.Str, group_name: magpie.typedefs.Str, email: magpie.typedefs.Str, password: magpie.typedefs.Str, db_session: sqlalchemy.orm.session.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.cli.register_defaults.
init_anonymous
(db_session: sqlalchemy.orm.session.Session, settings: Optional[AnySettingsContainer] = None) → None[source]¶ Registers into the database the user and group matching configuration values of.
magpie.constants.MAGPIE_ANONYMOUS_USER
andmagpie.constants.MAGPIE_ANONYMOUS_GROUP
respectively if not defined.Afterwards, updates the group’s parameters to ensure integrity with Magpie settings.
-
magpie.cli.register_defaults.
init_admin
(db_session: sqlalchemy.orm.session.Session, settings: Optional[AnySettingsContainer] = None) → None[source]¶ Registers into the database the user and group matching configuration values of.
magpie.constants.MAGPIE_ADMIN_USER
andmagpie.constants.MAGPIE_ADMIN_GROUP
respectively if not defined.Also associates the created admin user with the admin group and give it admin permissions. Finally, updates the group’s parameters to ensure integrity with Magpie settings.
-
magpie.cli.register_defaults.
init_users_group
(db_session: sqlalchemy.orm.session.Session, settings: Optional[AnySettingsContainer] = None) → None[source]¶ Registers into database the group matching
magpie.constants.MAGPIE_USERS_GROUP
if not defined.