join with specific id

This commit is contained in:
joshua-arts
2018-06-03 14:57:30 -04:00
parent 140547d035
commit 79949b4aa6
5 changed files with 26 additions and 6 deletions

View File

@ -25,6 +25,19 @@ class Room < ApplicationRecord
bbb.is_meeting_running?(bbb_id)
end
# Retrieves all the users in a room.
def participants
begin
res = bbb.get_meeting_info(bbb_id, nil)
res[:attendees].map do |att|
User.find_by(uid: att[:userID], name: att[:fullName])
end
rescue BigBlueButton::BigBlueButtonException => exc
# The meeting is most likely not running.
[]
end
end
# Determines the invite URL for the room.
def invite_path
"/r/#{uid}"
@ -40,6 +53,10 @@ class Room < ApplicationRecord
moderatorOnlyMessage: options[:moderator_message]
}
# Increment room sessions.
self.sessions += 1
self.save
#meeting_options.merge!(
#{ "meta_room-id": options[:room_owner],
# "meta_meeting-name": options[:meeting_name]}
@ -55,7 +72,7 @@ class Room < ApplicationRecord
# Returns a URL to join a user into a meeting.
def join_path(user, options = {})
user = user.name if user.is_a?(User)
username = user.name if user.is_a?(User)
# Create the meeting if it isn't running.
start_session(options) unless is_running?
@ -83,7 +100,7 @@ class Room < ApplicationRecord
end
# Generate the join URL.
bbb.join_meeting_url(bbb_id, user, password)
bbb.join_meeting_url(bbb_id, username, password, {userID: user.uid})
end
# Fetches all recordings for a meeting.

View File

@ -88,8 +88,9 @@ class User < ApplicationRecord
private
# Initializes a room for the user.
# Initializes a room for the user and assign a BigBlueButton user id.
def initialize_main_room
self.uid = "gl-#{(0...12).map { (65 + rand(26)).chr }.join.downcase}"
self.main_room = Room.create!(owner: self, name: firstname + "'s Room")
self.save
end