forked from External/greenlight
GRN2-129: Added server recordings and refactored adminsitrator panel (#662)
* Added server recordings and refactored adminsitrator panel * Fixed some issues * Fixed issue with owner email search * Fixed issue with edit user
This commit is contained in:
committed by
Jesus Federico
parent
8c63f793a5
commit
a055b88eb7
@ -19,7 +19,6 @@
|
||||
require 'bbb_api'
|
||||
|
||||
class Room < ApplicationRecord
|
||||
include ::APIConcern
|
||||
include ::BbbApi
|
||||
|
||||
before_create :setup
|
||||
@ -40,7 +39,7 @@ class Room < ApplicationRecord
|
||||
|
||||
# Checks if a room is running on the BigBlueButton server.
|
||||
def running?
|
||||
bbb.is_meeting_running?(bbb_id)
|
||||
bbb(owner.provider).is_meeting_running?(bbb_id)
|
||||
end
|
||||
|
||||
# Determines the invite path for the room.
|
||||
@ -62,7 +61,7 @@ class Room < ApplicationRecord
|
||||
|
||||
# Send the create request.
|
||||
begin
|
||||
meeting = bbb.create_meeting(name, bbb_id, create_options)
|
||||
meeting = bbb(owner.provider).create_meeting(name, bbb_id, create_options)
|
||||
# Update session info.
|
||||
unless meeting[:messageKey] == 'duplicateWarning'
|
||||
update_attributes(sessions: sessions + 1, last_session: DateTime.now)
|
||||
@ -84,10 +83,10 @@ class Room < ApplicationRecord
|
||||
options[:user_is_moderator] ||= false
|
||||
options[:meeting_recorded] ||= false
|
||||
|
||||
return call_invalid_res unless bbb
|
||||
return call_invalid_res unless bbb(owner.provider)
|
||||
|
||||
# Get the meeting info.
|
||||
meeting_info = bbb.get_meeting_info(bbb_id, nil)
|
||||
meeting_info = bbb(owner.provider).get_meeting_info(bbb_id, nil)
|
||||
|
||||
# Determine the password to use when joining.
|
||||
password = if options[:user_is_moderator]
|
||||
@ -101,7 +100,7 @@ class Room < ApplicationRecord
|
||||
join_opts[:userID] = uid if uid
|
||||
join_opts[:joinViaHtml5] = options[:join_via_html5] if options[:join_via_html5]
|
||||
|
||||
bbb.join_meeting_url(bbb_id, name, password, join_opts)
|
||||
bbb(owner.provider).join_meeting_url(bbb_id, name, password, join_opts)
|
||||
end
|
||||
|
||||
# Notify waiting users that a meeting has started.
|
||||
@ -111,7 +110,7 @@ class Room < ApplicationRecord
|
||||
|
||||
# Retrieves all the users in a room.
|
||||
def participants
|
||||
res = bbb.get_meeting_info(bbb_id, nil)
|
||||
res = bbb(owner.provider).get_meeting_info(bbb_id, nil)
|
||||
res[:attendees].map do |att|
|
||||
User.find_by(uid: att[:userID], name: att[:fullName])
|
||||
end
|
||||
@ -120,27 +119,18 @@ class Room < ApplicationRecord
|
||||
[]
|
||||
end
|
||||
|
||||
# Fetches all recordings for a room.
|
||||
def recordings(search_params = {}, ret_search_params = false)
|
||||
res = bbb.get_recordings(meetingID: bbb_id)
|
||||
|
||||
format_recordings(res, search_params, ret_search_params)
|
||||
end
|
||||
|
||||
# Fetches a rooms public recordings.
|
||||
def public_recordings(search_params = {}, ret_search_params = false)
|
||||
search, order_col, order_dir, recs = recordings(search_params, ret_search_params)
|
||||
[search, order_col, order_dir, recs.select { |r| r[:metadata][:"gl-listed"] == "true" }]
|
||||
def recording_count
|
||||
bbb(owner.provider).get_recordings(meetingID: bbb_id)[:recordings].length
|
||||
end
|
||||
|
||||
def update_recording(record_id, meta)
|
||||
meta[:recordID] = record_id
|
||||
bbb.send_api_request("updateRecordings", meta)
|
||||
bbb(owner.provider).send_api_request("updateRecordings", meta)
|
||||
end
|
||||
|
||||
# Deletes a recording from a room.
|
||||
def delete_recording(record_id)
|
||||
bbb.delete_recordings(record_id)
|
||||
bbb(owner.provider).delete_recordings(record_id)
|
||||
end
|
||||
|
||||
private
|
||||
@ -155,7 +145,7 @@ class Room < ApplicationRecord
|
||||
|
||||
# Deletes all recordings associated with the room.
|
||||
def delete_all_recordings
|
||||
record_ids = recordings.map { |r| r[:recordID] }
|
||||
record_ids = bbb(owner.provider).get_recordings(meetingID: bbb_id)[:recordings].pluck(:recordID)
|
||||
delete_recording(record_ids) unless record_ids.empty?
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user