magpie.cli.register_defaults ============================ .. py:module:: magpie.cli.register_defaults .. autoapi-nested-parse:: Magpie helpers for user and group registration. Attributes ---------- .. autoapisummary:: magpie.cli.register_defaults.LOGGER Functions --------- .. autoapisummary:: magpie.cli.register_defaults.register_user_with_group magpie.cli.register_defaults.init_anonymous magpie.cli.register_defaults.init_admin magpie.cli.register_defaults.init_users_group magpie.cli.register_defaults.register_defaults magpie.cli.register_defaults.make_parser magpie.cli.register_defaults.main Module Contents --------------- .. py:data:: LOGGER .. py:function:: register_user_with_group(user_name: magpie.typedefs.Str, group_name: magpie.typedefs.Str, email: magpie.typedefs.Str, password: Optional[magpie.typedefs.Str], db_session: sqlalchemy.orm.session.Session) -> None Registers the user if missing and associate him to a group specified by name, also created if missing. :param user_name: name of the user to create (if missing) and to make part of the group (if specified) :param group_name: name of the group to create (if missing and specified) and to make the user join (if not already) :param email: email of the user to be created (if missing) :param password: password of the user to be created (if missing), auto-generate if not provided (None). :param 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). .. py:function:: init_anonymous(db_session: sqlalchemy.orm.session.Session, settings: Optional[magpie.typedefs.AnySettingsContainer] = None) -> None Registers into the database the user and group matching configuration values of. :py:data:`magpie.constants.MAGPIE_ANONYMOUS_USER` and :py:data:`magpie.constants.MAGPIE_ANONYMOUS_GROUP` respectively if not defined. Afterwards, updates the group's parameters to ensure integrity with `Magpie` settings. .. py:function:: init_admin(db_session: sqlalchemy.orm.session.Session, settings: Optional[magpie.typedefs.AnySettingsContainer] = None) -> None Registers into the database the user and group matching configuration values of. :py:data:`magpie.constants.MAGPIE_ADMIN_USER` and :py:data:`magpie.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. .. py:function:: init_users_group(db_session: sqlalchemy.orm.session.Session, settings: Optional[magpie.typedefs.AnySettingsContainer] = None) -> None Registers into database the group matching :py:data:`magpie.constants.MAGPIE_USERS_GROUP` if not defined. .. py:function:: register_defaults(db_session: Optional[sqlalchemy.orm.session.Session] = None, settings: Optional[magpie.typedefs.AnySettingsContainer] = None, ini_file_path: Optional[magpie.typedefs.Str] = None) -> None Registers into database every undefined default users and groups matching following variables: - :py:data:`magpie.constants.MAGPIE_ANONYMOUS_USER` - :py:data:`magpie.constants.MAGPIE_USERS_GROUP` - :py:data:`magpie.constants.MAGPIE_ADMIN_GROUP` - :py:data:`magpie.constants.MAGPIE_ADMIN_USER` .. py:function:: make_parser() -> argparse.ArgumentParser .. py:function:: main(args: Optional[Sequence[magpie.typedefs.Str]] = None, parser: Optional[argparse.ArgumentParser] = None, namespace: Optional[argparse.Namespace] = None) -> Any