Added support for protected recordings (#2907)

This commit is contained in:
Ahmad Farhat 2021-09-19 14:14:53 -04:00 committed by GitHub
parent e0972efc40
commit 3987a8b913
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 0 deletions

View File

@ -119,6 +119,20 @@ module BbbServer
bbb_server.publish_recordings(record_id, false)
end
# Protect a recording
def protect_recording(record_id, meta = {})
meta[:recordID] = record_id
meta[:protect] = true
bbb_server.send_api_request("updateRecordings", meta)
end
# Unprotect a recording
def unprotect_recording(record_id, meta = {})
meta[:recordID] = record_id
meta[:protect] = false
bbb_server.send_api_request("updateRecordings", meta)
end
# Deletes a recording from a room.
def delete_recording(record_id)
bbb_server.delete_recordings(record_id)

View File

@ -28,6 +28,12 @@ class RecordingsController < ApplicationController
"meta_#{META_LISTED}" => (params[:state] == "public"),
}
if params[:state] == "protected"
protect_recording(params[:record_id])
else
unprotect_recording(params[:record_id])
end
if params[:state] == "inaccessible"
unpublish_recording(params[:record_id])
else

View File

@ -147,4 +147,9 @@ module ApplicationHelper
current_user&.role&.get_permission("can_launch_recording")
end
end
# Returns true if protected recordings is enabled on BigBlueButton/Scalelite server
def protected_recording?(rec)
!rec[:protected].nil?
end
end

View File

@ -52,6 +52,8 @@
<div class="dropdown">
<% if recording[:metadata][:"gl-listed"] == "true" %>
<button class="btn btn-sm btn-secondary dropdown-toggle" data-toggle="dropdown"><i class="dropdown-icon fas fa-globe px-2"></i> <%= t("recording.visibility.public") %></button>
<% elsif recording[:protected] == "true" %>
<button class="btn btn-sm btn-secondary dropdown-toggle" data-toggle="dropdown"><i class="dropdown-icon fas fa-shield-alt px-2"></i> <%= t("recording.visibility.protected") %></button>
<% elsif !recording[:published] %>
<button class="btn btn-sm btn-secondary dropdown-toggle" data-toggle="dropdown"><i class="dropdown-icon fas fa-lock px-2"></i> <%= t("recording.visibility.inaccessible") %></button>
<% else %>
@ -61,6 +63,11 @@
<%= button_to update_recording_path(meetingID: recording[:meetingID], record_id: recording[:recordID], state: "public"), class: "dropdown-item", "data-disable": "" do %>
<i class="dropdown-icon fas fa-globe"></i> <%= t("recording.visibility.public") %>
<% end %>
<% if protected_recording?(recording) %>
<%= button_to update_recording_path(meetingID: recording[:meetingID], record_id: recording[:recordID], state: "protected"), class: "dropdown-item", "data-disable": "" do %>
<i class="dropdown-icon fas fa-shield-alt"></i> <%= t("recording.visibility.protected") %>
<% end %>
<% end %>
<%= button_to update_recording_path(meetingID: recording[:meetingID], record_id: recording[:recordID], state: "unlisted"), class: "dropdown-item", "data-disable": "" do %>
<i class="dropdown-icon fas fa-link"></i> <%= t("recording.visibility.unlisted") %>
<% end %>