diff --git a/web/b3desk/__init__.py b/web/b3desk/__init__.py index 59073d22..b3bad28c 100644 --- a/web/b3desk/__init__.py +++ b/web/b3desk/__init__.py @@ -110,7 +110,7 @@ def setup_database(app): def setup_jinja(app): - from b3desk.models.meetings import Role + from b3desk.models.roles import Role from b3desk.session import get_current_user from b3desk.session import has_user_session @@ -147,7 +147,7 @@ def global_processor(): def setup_flask(app): with app.app_context(): from b3desk.models.meetings import Meeting - from b3desk.models.meetings import Role + from b3desk.models.roles import Role from b3desk.models.users import User for model in (Meeting, User): diff --git a/web/b3desk/endpoints/api.py b/web/b3desk/endpoints/api.py index f96941dd..b611ccb8 100644 --- a/web/b3desk/endpoints/api.py +++ b/web/b3desk/endpoints/api.py @@ -1,7 +1,7 @@ from flask import Blueprint from flask import request -from b3desk.models.meetings import Role +from b3desk.models.roles import Role from b3desk.models.users import get_or_create_user from .. import auth diff --git a/web/b3desk/endpoints/join.py b/web/b3desk/endpoints/join.py index fc911e4b..262b726d 100644 --- a/web/b3desk/endpoints/join.py +++ b/web/b3desk/endpoints/join.py @@ -14,9 +14,9 @@ from b3desk.forms import JoinMeetingForm from b3desk.models import db from b3desk.models.meetings import Meeting -from b3desk.models.meetings import Role from b3desk.models.meetings import get_mail_meeting from b3desk.models.meetings import get_meeting_from_meeting_id_and_user_id +from b3desk.models.roles import Role from .. import auth from ..session import get_authenticated_attendee_fullname diff --git a/web/b3desk/endpoints/meetings.py b/web/b3desk/endpoints/meetings.py index 4502bf3e..33c81353 100644 --- a/web/b3desk/endpoints/meetings.py +++ b/web/b3desk/endpoints/meetings.py @@ -25,8 +25,8 @@ from b3desk.forms import ShowMeetingForm from b3desk.models import db from b3desk.models.meetings import Meeting -from b3desk.models.meetings import Role from b3desk.models.meetings import get_quick_meeting_from_user_and_random_string +from b3desk.models.roles import Role from b3desk.models.users import User from .. import auth diff --git a/web/b3desk/models/bbb.py b/web/b3desk/models/bbb.py index ed347f00..ab468dd7 100644 --- a/web/b3desk/models/bbb.py +++ b/web/b3desk/models/bbb.py @@ -22,6 +22,7 @@ from b3desk.tasks import background_upload from .. import cache +from .roles import Role def cache_key(func, caller, prepped, *args, **kwargs): @@ -86,7 +87,6 @@ def is_meeting_running(self): def create(self): """https://docs.bigbluebutton.org/development/api/#create""" - from .meetings import Role params = { "meetingID": self.meeting.meetingID, @@ -270,8 +270,6 @@ def update_recordings(self, recording_ids, metadata): def prepare_request_to_join_bbb(self, meeting_role, fullname): """https://docs.bigbluebutton.org/dev/api.html#join""" - from .meetings import Role - params = { "fullName": fullname, "meetingID": self.meeting.meetingID, diff --git a/web/b3desk/models/meetings.py b/web/b3desk/models/meetings.py index f0521687..0e8946cc 100644 --- a/web/b3desk/models/meetings.py +++ b/web/b3desk/models/meetings.py @@ -11,7 +11,6 @@ import hashlib from datetime import datetime from datetime import timedelta -from enum import StrEnum from flask import current_app from flask import url_for @@ -21,17 +20,12 @@ from b3desk.utils import secret_key from . import db +from .roles import Role from .users import User MODERATOR_ONLY_MESSAGE_MAXLENGTH = 150 -class Role(StrEnum): - attendee = "attendee" - moderator = "moderator" - authenticated = "authenticated" - - class MeetingFiles(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.Unicode(4096)) diff --git a/web/b3desk/models/roles.py b/web/b3desk/models/roles.py new file mode 100644 index 00000000..b2af0b2d --- /dev/null +++ b/web/b3desk/models/roles.py @@ -0,0 +1,7 @@ +from enum import StrEnum + + +class Role(StrEnum): + attendee = "attendee" + moderator = "moderator" + authenticated = "authenticated" diff --git a/web/b3desk/utils.py b/web/b3desk/utils.py index 806a4f8b..cd7b58bc 100644 --- a/web/b3desk/utils.py +++ b/web/b3desk/utils.py @@ -16,6 +16,7 @@ from werkzeug.routing import BaseConverter from b3desk.models import db +from b3desk.models.roles import Role def secret_key(): @@ -57,8 +58,6 @@ def get_random_alphanumeric_string(length): def send_quick_meeting_mail(meeting, to_email): - from b3desk.models.meetings import Role - smtp_from = current_app.config["SMTP_FROM"] smtp_host = current_app.config["SMTP_HOST"] smtp_port = current_app.config["SMTP_PORT"] diff --git a/web/tests/meeting/test_join.py b/web/tests/meeting/test_join.py index 0553ee3b..1d225c14 100644 --- a/web/tests/meeting/test_join.py +++ b/web/tests/meeting/test_join.py @@ -4,7 +4,7 @@ from flask import url_for -from b3desk.models.meetings import Role +from b3desk.models.roles import Role def test_signin_meeting(client_app, meeting, user, bbb_response): diff --git a/web/tests/meeting/test_meeting.py b/web/tests/meeting/test_meeting.py index 66126a17..82d2132c 100644 --- a/web/tests/meeting/test_meeting.py +++ b/web/tests/meeting/test_meeting.py @@ -11,7 +11,7 @@ from b3desk.models.meetings import MODERATOR_ONLY_MESSAGE_MAXLENGTH from b3desk.models.meetings import Meeting from b3desk.models.meetings import MeetingFiles -from b3desk.models.meetings import Role +from b3desk.models.roles import Role @pytest.fixture() @@ -536,7 +536,6 @@ def test_create_without_logout_url_gets_default( def test_create_quick_meeting(client_app, monkeypatch, user, mocker, bbb_response): from b3desk.endpoints.meetings import get_quick_meeting_from_user_and_random_string - from b3desk.models.meetings import Role mocker.patch("b3desk.tasks.background_upload.delay", return_value=True) monkeypatch.setattr("b3desk.models.users.User.id", 1)