Exemple #1
0
def create_user_offerer(user: User, offerer: Offerer) -> UserOfferer:
    user_offerer = UserOfferer()
    user_offerer.user = user
    user_offerer.offerer = offerer
    user_offerer.rights = RightsType.editor

    return user_offerer
Exemple #2
0
def fill_user_offerer_from(user_offerer: UserOfferer, created_user: User,
                           created_offerer: Offerer) -> UserOfferer:
    if created_user.id is None:
        raise UserNotCreatedException()
    if created_offerer.id is None:
        raise OffererNotCreatedException()

    user_offerer.user = created_user
    user_offerer.offerer = created_offerer
    user_offerer.rights = RightsType.editor
    return user_offerer
Exemple #3
0
def create_user_offerer(user: User,
                        offerer: Offerer,
                        idx: int = None,
                        is_admin: bool = False,
                        validation_token: str = None) -> UserOfferer:
    user_offerer = UserOfferer()
    user_offerer.id = idx
    user_offerer.offerer = offerer
    user_offerer.rights = RightsType.admin if is_admin else RightsType.editor
    user_offerer.user = user
    user_offerer.validationToken = validation_token

    return user_offerer