Skip to content

Commit

Permalink
Added support for protected recordings (#2907)
Browse files Browse the repository at this point in the history
  • Loading branch information
farhatahmad authored Sep 19, 2021
1 parent e0972ef commit 3987a8b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/controllers/concerns/bbb_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@ def unpublish_recording(record_id)
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)
Expand Down
6 changes: 6 additions & 0 deletions app/controllers/recordings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ def update
"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
Expand Down
5 changes: 5 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,9 @@ def perm_to_record_meeting
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
7 changes: 7 additions & 0 deletions app/views/shared/components/_recording_row.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
Expand All @@ -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 %>
Expand Down

0 comments on commit 3987a8b

Please sign in to comment.