Skip to content

Commit

Permalink
Ravem: Ignore Zoom Rooms + remove Vidyo stuff (#189)
Browse files Browse the repository at this point in the history
* Ignore rooms that use Zoom Rooms
* Remove obsolete vidyo references
  • Loading branch information
ThiefMaster authored Dec 5, 2024
1 parent cd2ab50 commit a59408d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
7 changes: 0 additions & 7 deletions ravem/indico_ravem/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,6 @@ def _process_args(self):

class RHRavemRoomStatus(RHRavemBase):
def _process(self):
if self.event_vc_room.vc_room.type == 'vidyo':
return {
'success': False,
'reason': 'unsupported',
'message': '<a target="_blank" href="https://cern.ch/go/6SNm">'
'Vidyo is no longer supported</a>'
}
try:
response = get_room_status(self.room.name, self.room.verbose_name)
response['success'] = True
Expand Down
2 changes: 1 addition & 1 deletion ravem/indico_ravem/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def get_vars_js(self): # pragma: no cover

def inject_connect_button(self, template, event_vc_room, **kwargs): # pragma: no cover
from indico_ravem.util import has_access
if event_vc_room.vc_room.type not in ('vidyo', 'zoom') or not has_access(event_vc_room):
if event_vc_room.vc_room.type != 'zoom' or not has_access(event_vc_room):
return

return render_plugin_template(template, room_name=event_vc_room.link_object.room.name,
Expand Down
2 changes: 2 additions & 0 deletions ravem/indico_ravem/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ def has_access(event_vc_room, _split_re=re.compile(r'[\s,;]+')):
feature = RavemPlugin.settings.get('room_feature')
if not room or (feature and not (set(feature.equipment_types) & set(room.available_equipment))):
return False
elif room.get_attribute_value('zoom-rooms-calendar-id'):
return False

ips = {_f for _f in (x.strip() for x in _split_re.split(room.get_attribute_value('ip', ''))) if _f}
host = vc_room.data.get('host') or vc_room.data.get('owner')
Expand Down
10 changes: 8 additions & 2 deletions ravem/tests/util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ def test_unlinked_room_has_no_access(mocker):
assert not has_access(event_vc_room)


def _mock_get_attribute_value(name, default=None):
if name == 'ip':
return '111.222.123.123'
return default


@pytest.mark.usefixtures('db', 'request_context')
def test_check_if_current_user_is_room_owner(mocker):
session = mocker.patch('indico_ravem.util.session')
Expand All @@ -208,7 +214,7 @@ def test_check_if_current_user_is_room_owner(mocker):

event_vc_room = MagicMock()
event_vc_room.link_object.room.has_equipment = MagicMock(return_value=True)
event_vc_room.link_object.room.get_attribute_value.return_value = request.remote_addr
event_vc_room.link_object.room.get_attribute_value = _mock_get_attribute_value
event_vc_room.vc_room.data.get.return_value = 'User:123'
event_vc_room.event.can_manage.return_value = False

Expand All @@ -225,7 +231,7 @@ def test_check_if_current_user_can_modify(mocker):

event_vc_room = MagicMock()
event_vc_room.link_object.room.has_equipment = MagicMock(return_value=True)
event_vc_room.link_object.room.get_attribute_value.return_value = request.remote_addr
event_vc_room.link_object.room.get_attribute_value = _mock_get_attribute_value
event_vc_room.event.can_manage.return_value = True

assert has_access(event_vc_room)
Expand Down

0 comments on commit a59408d

Please sign in to comment.