magpie.api.management.register.register_utils

Module Contents

Classes

TokenOperation

Supported operations by the temporary tokens.

Functions

handle_temporary_token(tmp_token: magpie.models.TemporaryToken, db_session: sqlalchemy.orm.session.Session) → None

Handles the operation according to the provided temporary token.

get_discoverable_groups(db_session: sqlalchemy.orm.session.Session) → List[models.Group]

Get all existing group that are marked as publicly discoverable from the database.

get_discoverable_group_by_name(group_name: magpie.typedefs.Str, db_session: sqlalchemy.orm.session.Session) → magpie.models.Group

Obtains the requested discoverable group by name.

class magpie.api.management.register.register_utils.TokenOperation[source]

Bases: magpie.utils.ExtendedEnum

Supported operations by the temporary tokens.

GROUP_ACCEPT_TERMS = group-accept-terms[source]
USER_PASSWORD_RESET = user-password-reset[source]
WEBHOOK_CREATE_USER_ERROR = webhook-create-user-error[source]
magpie.api.management.register.register_utils.handle_temporary_token(tmp_token: magpie.models.TemporaryToken, db_session: sqlalchemy.orm.session.Session) → None[source]

Handles the operation according to the provided temporary token.

magpie.api.management.register.register_utils.get_discoverable_groups(db_session: sqlalchemy.orm.session.Session) → List[models.Group][source]

Get all existing group that are marked as publicly discoverable from the database.

magpie.api.management.register.register_utils.get_discoverable_group_by_name(group_name: magpie.typedefs.Str, db_session: sqlalchemy.orm.session.Session)magpie.models.Group[source]

Obtains the requested discoverable group by name.

Note

For security reason, an existing group that is NOT discoverable will return NotFound instead of Forbidden. Otherwise we give an indication to a potentially non-admin user that some group of that name exists.

Returns

found group matched by name

Raises

HTTPNotFound – if the group cannot be found or if matched group name is not discoverable.