bigbluebutton_rails 1.3.0 → 1.4.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.rspec +2 -2
- data/.ruby-version +1 -1
- data/CHANGELOG.rdoc +31 -6
- data/Gemfile +13 -3
- data/Gemfile.lock +88 -42
- data/README.rdoc +84 -15
- data/Rakefile +22 -25
- data/{TODO_08 → TODO.rdoc} +6 -2
- data/app/assets/images/badges/apple_store_en.png +0 -0
- data/app/assets/images/badges/apple_store_pt-br.png +0 -0
- data/app/assets/images/badges/google_play_en.png +0 -0
- data/app/assets/images/badges/google_play_pt-br.png +0 -0
- data/app/controllers/bigbluebutton/recordings_controller.rb +25 -10
- data/app/controllers/bigbluebutton/rooms_controller.rb +158 -141
- data/app/controllers/bigbluebutton/servers_controller.rb +25 -12
- data/app/helpers/bigbluebutton_rails_helper.rb +20 -0
- data/app/models/bigbluebutton_meeting.rb +28 -0
- data/app/models/bigbluebutton_metadata.rb +2 -2
- data/app/models/bigbluebutton_playback_format.rb +2 -2
- data/app/models/bigbluebutton_recording.rb +29 -4
- data/app/models/bigbluebutton_room.rb +153 -22
- data/app/models/bigbluebutton_room_options.rb +46 -0
- data/app/models/bigbluebutton_server.rb +4 -2
- data/app/views/bigbluebutton/recordings/_form.html.erb +4 -0
- data/app/views/bigbluebutton/recordings/_recordings.html.erb +1 -0
- data/app/views/bigbluebutton/recordings/show.html.erb +5 -0
- data/app/views/bigbluebutton/rooms/join_mobile.html.erb +29 -5
- data/app/workers/bigbluebutton_meeting_updater.rb +31 -0
- data/bigbluebutton_rails.gemspec +5 -1
- data/config/locales/en.yml +6 -5
- data/config/schedule.rb +4 -0
- data/lib/bigbluebutton_rails/controller_methods.rb +29 -10
- data/lib/bigbluebutton_rails/internal_controller_methods.rb +56 -0
- data/lib/bigbluebutton_rails/rails/routes.rb +1 -5
- data/lib/bigbluebutton_rails/version.rb +1 -1
- data/lib/bigbluebutton_rails.rb +11 -0
- data/lib/generators/bigbluebutton_rails/templates/migration.rb +28 -0
- data/lib/generators/bigbluebutton_rails/templates/migration_1_4_0.rb +37 -0
- data/lib/tasks/bigbluebutton_rails/meetings.rake +22 -0
- data/lib/tasks/bigbluebutton_rails/recordings.rake +2 -1
- data/spec/classes/bigbluebutton_attendee_spec.rb +1 -1
- data/spec/controllers/bigbluebutton/recordings_controller_json_responses_spec.rb +10 -9
- data/spec/controllers/bigbluebutton/recordings_controller_spec.rb +103 -16
- data/spec/controllers/bigbluebutton/rooms_controller_exception_handling_spec.rb +15 -5
- data/spec/controllers/bigbluebutton/rooms_controller_json_responses_spec.rb +17 -12
- data/spec/controllers/bigbluebutton/rooms_controller_spec.rb +485 -432
- data/spec/controllers/bigbluebutton/servers_controller_json_responses_spec.rb +20 -13
- data/spec/controllers/bigbluebutton/servers_controller_spec.rb +174 -16
- data/spec/factories/bigbluebutton_meeting.rb +13 -0
- data/spec/factories/bigbluebutton_recording.rb +4 -2
- data/spec/factories/bigbluebutton_room.rb +5 -1
- data/spec/factories/bigbluebutton_room_options.rb +6 -0
- data/spec/generators/install_generator_spec.rb +1 -1
- data/spec/generators/views_generator_spec.rb +0 -1
- data/spec/lib/tasks/meetings_rake_spec.rb +5 -0
- data/spec/lib/tasks/recordings_rake_spec.rb +5 -0
- data/spec/models/bigbluebutton_meeting_db_spec.rb +24 -0
- data/spec/models/bigbluebutton_meeting_spec.rb +52 -0
- data/spec/models/bigbluebutton_metadata_db_spec.rb +2 -0
- data/spec/models/bigbluebutton_metadata_spec.rb +18 -22
- data/spec/models/bigbluebutton_playback_format_db_spec.rb +2 -0
- data/spec/models/bigbluebutton_playback_format_spec.rb +0 -4
- data/spec/models/bigbluebutton_recording_db_spec.rb +3 -0
- data/spec/models/bigbluebutton_recording_spec.rb +69 -16
- data/spec/models/bigbluebutton_room_db_spec.rb +2 -0
- data/spec/models/bigbluebutton_room_options_db_spec.rb +16 -0
- data/spec/models/bigbluebutton_room_options_spec.rb +206 -0
- data/spec/models/bigbluebutton_room_spec.rb +420 -80
- data/spec/models/bigbluebutton_server_db_spec.rb +2 -0
- data/spec/models/bigbluebutton_server_spec.rb +22 -24
- data/spec/rails_app/config/application.rb +3 -0
- data/spec/rails_app/config/database.yml.example +28 -0
- data/spec/rails_app/config/environments/test.rb +1 -1
- data/spec/rails_app/db/seeds.rb +1 -0
- data/spec/rails_app/features/step_definitions/activity_monitor_servers_step.rb +0 -2
- data/spec/rails_app/features/step_definitions/common_steps.rb +6 -0
- data/spec/rails_app/features/step_definitions/join_rooms_steps.rb +0 -6
- data/spec/rails_app/features/support/locales.rb +4 -2
- data/spec/rails_app/features/support/paths.rb +0 -2
- data/spec/rails_app/features/support/templates.rb +2 -17
- data/spec/rails_app/lib/tasks/db/populate.rake +2 -0
- data/spec/rails_app/lib/tasks/resque.rake +3 -0
- data/spec/routing/bigbluebutton/custom_controllers_routing_spec.rb +1 -10
- data/spec/routing/bigbluebutton/rooms_only_routing_spec.rb +1 -9
- data/spec/routing/bigbluebutton/rooms_routing_spec.rb +3 -31
- data/spec/spec_helper.rb +40 -24
- data/spec/support/matchers/array_with_key.rb +7 -0
- data/spec/support/matchers/array_without_key.rb +7 -0
- data/spec/support/matchers/delegate_matcher.rb +62 -0
- data/spec/support/matchers/respond_with_content_type.rb +8 -0
- data/spec/support/matchers/shoulda/assign_to_matcher.rb +131 -0
- data/spec/support/mocked_server.rb +2 -2
- data/spec/support/models/user.rb +11 -0
- data/spec/workers/bigbluebutton_meeting_updater_spec.rb +9 -0
- metadata +86 -16
- data/app/views/bigbluebutton/rooms/external.html.erb +0 -25
- data/spec/rails_app/config/database.yml +0 -25
- data/spec/rails_app/features/join_external_rooms.feature +0 -61
data/Rakefile
CHANGED
@@ -31,30 +31,23 @@ namespace :rails_app do
|
|
31
31
|
desc 'Setup rails app used in tests.'
|
32
32
|
task :install do |app|
|
33
33
|
cd File.join(File.dirname(__FILE__), "spec", "rails_app")
|
34
|
-
sh "rails destroy bigbluebutton_rails:install"
|
35
|
-
sh "rails generate bigbluebutton_rails:install"
|
34
|
+
sh "bundle exec rails destroy bigbluebutton_rails:install"
|
35
|
+
sh "bundle exec rails generate bigbluebutton_rails:install"
|
36
36
|
cd File.dirname(__FILE__)
|
37
37
|
end
|
38
38
|
|
39
39
|
desc 'Setup the db in the rails app used in tests.'
|
40
40
|
task :db do
|
41
41
|
cd File.join(File.dirname(__FILE__), "spec", "rails_app")
|
42
|
-
|
43
|
-
sh "rake db:drop:
|
44
|
-
sh "rake db:create:all"
|
45
|
-
# development
|
46
|
-
sh "rake db:migrate RAILS_ENV=development"
|
47
|
-
sh "rake db:seed RAILS_ENV=development"
|
48
|
-
# test
|
49
|
-
sh "rake db:migrate RAILS_ENV=test"
|
50
|
-
sh "rake db:test:prepare RAILS_ENV=test"
|
42
|
+
sh "bundle exec rake db:drop db:create db:migrate db:seed RAILS_ENV=development"
|
43
|
+
sh "bundle exec rake db:drop db:create db:migrate db:test:prepare RAILS_ENV=test"
|
51
44
|
cd File.dirname(__FILE__)
|
52
45
|
end
|
53
46
|
|
54
47
|
desc 'Populate the db in the test app'
|
55
48
|
task :populate do
|
56
49
|
cd "spec/rails_app/"
|
57
|
-
sh "rake db:populate"
|
50
|
+
sh "bundle exec rake db:populate"
|
58
51
|
cd "../.."
|
59
52
|
end
|
60
53
|
|
@@ -62,7 +55,7 @@ namespace :rails_app do
|
|
62
55
|
desc 'Updates the recordings'
|
63
56
|
task :update do
|
64
57
|
cd "spec/rails_app/"
|
65
|
-
sh "rake bigbluebutton_rails:recordings:update"
|
58
|
+
sh "bundle exec rake bigbluebutton_rails:recordings:update"
|
66
59
|
cd "../.."
|
67
60
|
end
|
68
61
|
end
|
@@ -71,12 +64,12 @@ end
|
|
71
64
|
task :cucumber do
|
72
65
|
if File.exists? "features/"
|
73
66
|
puts "* Gem features"
|
74
|
-
sh "cucumber features/"
|
67
|
+
sh "bundle exec cucumber features/"
|
75
68
|
end
|
76
69
|
|
77
70
|
puts "* Dummy app features"
|
78
71
|
cd File.join(File.dirname(__FILE__), "spec", "rails_app")
|
79
|
-
sh "cucumber features/"
|
72
|
+
sh "bundle exec cucumber features/"
|
80
73
|
cd File.dirname(__FILE__)
|
81
74
|
end
|
82
75
|
|
@@ -89,28 +82,32 @@ desc 'Setup the rails_app using the migration files created when upgrading the g
|
|
89
82
|
namespace :spec do
|
90
83
|
task :migrations do |app|
|
91
84
|
cd "spec/rails_app/"
|
92
|
-
sh "rails destroy bigbluebutton_rails:install"
|
93
|
-
sh "rails generate bigbluebutton_rails:install 0.0.4"
|
94
|
-
sh "rails generate bigbluebutton_rails:install 0.0.5 --migration-only"
|
85
|
+
sh "bundle exec rails destroy bigbluebutton_rails:install"
|
86
|
+
sh "bundle exec rails generate bigbluebutton_rails:install 0.0.4"
|
87
|
+
sh "bundle exec rails generate bigbluebutton_rails:install 0.0.5 --migration-only"
|
88
|
+
sh "bundle exec rails generate bigbluebutton_rails:install 1.3.0 --migration-only"
|
89
|
+
sh "bundle exec rails generate bigbluebutton_rails:install 1.4.0 --migration-only"
|
95
90
|
|
96
|
-
sh "rake db:drop RAILS_ENV=test"
|
97
|
-
sh "rake db:create RAILS_ENV=test"
|
98
|
-
sh "rake db:migrate RAILS_ENV=test"
|
99
|
-
sh "rake db:test:prepare RAILS_ENV=test"
|
91
|
+
sh "bundle exec rake db:drop RAILS_ENV=test"
|
92
|
+
sh "bundle exec rake db:create RAILS_ENV=test"
|
93
|
+
sh "bundle exec rake db:migrate RAILS_ENV=test"
|
94
|
+
sh "bundle exec rake db:test:prepare RAILS_ENV=test"
|
100
95
|
|
101
96
|
cd "../.."
|
102
97
|
Rake::Task["spec"].invoke
|
103
98
|
Rake::Task["cucumber"].invoke
|
104
99
|
|
105
100
|
cd "spec/rails_app/"
|
106
|
-
sh "rails destroy bigbluebutton_rails:install
|
107
|
-
sh "rails destroy bigbluebutton_rails:install
|
101
|
+
sh "bundle exec rails destroy bigbluebutton_rails:install 1.4.0 --migration-only"
|
102
|
+
sh "bundle exec rails destroy bigbluebutton_rails:install 1.3.0 --migration-only"
|
103
|
+
sh "bundle exec rails destroy bigbluebutton_rails:install 0.0.5 --migration-only"
|
104
|
+
sh "bundle exec rails destroy bigbluebutton_rails:install 0.0.4"
|
108
105
|
end
|
109
106
|
end
|
110
107
|
|
111
108
|
desc 'Generate the best practices report'
|
112
109
|
task :best_practices do |app|
|
113
|
-
sh "rails_best_practices -f html --spec &>/dev/null"
|
110
|
+
sh "bundle exec rails_best_practices -f html --spec &>/dev/null"
|
114
111
|
puts
|
115
112
|
puts "Output will be in the file rails_best_practices_output.html"
|
116
113
|
puts
|
data/{TODO_08 → TODO.rdoc}
RENAMED
@@ -1,12 +1,16 @@
|
|
1
|
-
TODOs for BigBlueButton 0.8:
|
2
|
-
|
3
1
|
TODO:
|
4
2
|
* Pre-upload of slides
|
5
3
|
* 'userID' argument in 'join' and in the respone of 'getMeetingInfo'.
|
6
4
|
* 'createTime' argument in 'join' and in the response of 'create'.
|
7
5
|
* New return values (e.g). 'createTime'.
|
8
6
|
* We don't need to randomize the meeting_id anymore (to confirm)
|
7
|
+
* Options 'redirectClient' and 'clientURL' on 'create'
|
8
|
+
* Options 'configToken' and 'avatarURL' on 'join'
|
9
|
+
* 'getDefaultConfigXML' and 'setConfigXML'. They are already used when a user joins a meeting,
|
10
|
+
to set the custom options configured in the target room. But these API methods cannot be called
|
11
|
+
individually yet.
|
9
12
|
|
10
13
|
See:
|
14
|
+
* https://code.google.com/p/bigbluebutton/wiki/API#Updates_to_API_in_BigBlueButton_0.81
|
11
15
|
* http://code.google.com/p/bigbluebutton/wiki/API#Version_0.80
|
12
16
|
* http://groups.google.com/group/bigbluebutton-dev/browse_thread/thread/c214cbe9bdb2268a?pli=1
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,4 +1,5 @@
|
|
1
1
|
class Bigbluebutton::RecordingsController < ApplicationController
|
2
|
+
include BigbluebuttonRails::InternalControllerMethods
|
2
3
|
|
3
4
|
respond_to :html
|
4
5
|
respond_to :json, :only => [:index, :show, :update, :destroy, :publish, :unpublish]
|
@@ -19,14 +20,14 @@ class Bigbluebutton::RecordingsController < ApplicationController
|
|
19
20
|
|
20
21
|
def update
|
21
22
|
respond_with @recording do |format|
|
22
|
-
if @recording.update_attributes(
|
23
|
+
if @recording.update_attributes(recording_params)
|
23
24
|
format.html {
|
24
25
|
message = t('bigbluebutton_rails.recordings.notice.update.success')
|
25
|
-
|
26
|
+
redirect_to_using_params @recording, :notice => message
|
26
27
|
}
|
27
|
-
format.json {
|
28
|
+
format.json { render :json => true, :status => :ok }
|
28
29
|
else
|
29
|
-
format.html {
|
30
|
+
format.html { redirect_to_params_or_render :edit }
|
30
31
|
format.json { render :json => @recording.errors.full_messages, :status => :unprocessable_entity }
|
31
32
|
end
|
32
33
|
end
|
@@ -52,14 +53,14 @@ class Bigbluebutton::RecordingsController < ApplicationController
|
|
52
53
|
format.html {
|
53
54
|
if error
|
54
55
|
flash[:error] = message
|
55
|
-
|
56
|
+
redirect_to_using_params bigbluebutton_recordings_url
|
56
57
|
else
|
57
|
-
|
58
|
+
redirect_to_using_params bigbluebutton_recordings_url, :notice => message
|
58
59
|
end
|
59
60
|
}
|
60
61
|
format.json {
|
61
62
|
if error
|
62
|
-
|
63
|
+
render :json => { :message => message }, :status => :error
|
63
64
|
else
|
64
65
|
render :json => { :message => message }
|
65
66
|
end
|
@@ -79,7 +80,7 @@ class Bigbluebutton::RecordingsController < ApplicationController
|
|
79
80
|
redirect_to playback.url
|
80
81
|
else
|
81
82
|
flash[:error] = t('bigbluebutton_rails.recordings.errors.play.no_format')
|
82
|
-
|
83
|
+
redirect_to_using_params bigbluebutton_recording_url(@recording)
|
83
84
|
end
|
84
85
|
}
|
85
86
|
end
|
@@ -125,18 +126,32 @@ class Bigbluebutton::RecordingsController < ApplicationController
|
|
125
126
|
else
|
126
127
|
message = t('bigbluebutton_rails.recordings.notice.unpublish.success')
|
127
128
|
end
|
128
|
-
format.html {
|
129
|
+
format.html {
|
130
|
+
redirect_to_using_params bigbluebutton_recording_path(@recording), :notice => message
|
131
|
+
}
|
129
132
|
format.json { render :json => message }
|
130
133
|
end
|
131
134
|
rescue BigBlueButton::BigBlueButtonException => e
|
132
135
|
respond_with do |format|
|
133
136
|
format.html {
|
134
137
|
flash[:error] = e.to_s[0..200]
|
135
|
-
|
138
|
+
redirect_to_using_params bigbluebutton_recording_path(@recording)
|
136
139
|
}
|
137
140
|
format.json { render :json => e.to_s[0..200], :status => :error }
|
138
141
|
end
|
139
142
|
end
|
140
143
|
end
|
141
144
|
|
145
|
+
def recording_params
|
146
|
+
unless params[:bigbluebutton_recording].nil?
|
147
|
+
params[:bigbluebutton_recording].permit(*recording_allowed_params)
|
148
|
+
else
|
149
|
+
[]
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
def recording_allowed_params
|
154
|
+
[ :recordid, :meetingid, :name, :published, :start_time, :end_time, :available, :description ]
|
155
|
+
end
|
156
|
+
|
142
157
|
end
|
@@ -1,12 +1,18 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
require 'bigbluebutton_api'
|
2
3
|
|
3
4
|
class Bigbluebutton::RoomsController < ApplicationController
|
5
|
+
include BigbluebuttonRails::InternalControllerMethods
|
4
6
|
|
5
|
-
before_filter :find_room, :except => [:index, :create, :new, :
|
6
|
-
before_filter :find_server, :only => [:external, :external_auth]
|
7
|
+
before_filter :find_room, :except => [:index, :create, :new, :join]
|
7
8
|
|
8
9
|
# set headers only in actions that might trigger api calls
|
9
|
-
before_filter :set_request_headers, :only => [:join_mobile, :end, :running, :join, :destroy
|
10
|
+
before_filter :set_request_headers, :only => [:join_mobile, :end, :running, :join, :destroy]
|
11
|
+
|
12
|
+
before_filter :join_check_room, :only => :join
|
13
|
+
before_filter :join_user_params, :only => :join
|
14
|
+
before_filter :join_check_can_create, :only => :join
|
15
|
+
before_filter :join_check_redirect_to_mobile, :only => :join
|
10
16
|
|
11
17
|
respond_to :html, :except => :running
|
12
18
|
respond_to :json, :only => [:running, :show, :new, :index, :create, :update]
|
@@ -28,10 +34,11 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
28
34
|
end
|
29
35
|
|
30
36
|
def create
|
31
|
-
@room = BigbluebuttonRoom.new(
|
37
|
+
@room = BigbluebuttonRoom.new(room_params)
|
32
38
|
|
33
|
-
if
|
34
|
-
params[:bigbluebutton_room]
|
39
|
+
if params[:bigbluebutton_room] and
|
40
|
+
(not params[:bigbluebutton_room].has_key?(:meetingid) or
|
41
|
+
params[:bigbluebutton_room][:meetingid].blank?)
|
35
42
|
@room.meetingid = @room.name
|
36
43
|
end
|
37
44
|
|
@@ -39,17 +46,15 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
39
46
|
if @room.save
|
40
47
|
message = t('bigbluebutton_rails.rooms.notice.create.success')
|
41
48
|
format.html {
|
42
|
-
|
49
|
+
redirect_to_using_params bigbluebutton_room_path(@room), :notice => message
|
50
|
+
}
|
51
|
+
format.json {
|
52
|
+
render :json => { :message => message }, :status => :created
|
43
53
|
}
|
44
|
-
format.json { render :json => { :message => message }, :status => :created }
|
45
54
|
else
|
46
55
|
format.html {
|
47
|
-
|
48
|
-
|
49
|
-
redirect_to params[:redir_url], :error => message
|
50
|
-
else
|
51
|
-
render :new
|
52
|
-
end
|
56
|
+
message = t('bigbluebutton_rails.rooms.notice.create.failure')
|
57
|
+
redirect_to_params_or_render :new, :error => message
|
53
58
|
}
|
54
59
|
format.json { render :json => @room.errors.full_messages, :status => :unprocessable_entity }
|
55
60
|
end
|
@@ -58,20 +63,16 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
58
63
|
|
59
64
|
def update
|
60
65
|
respond_with @room do |format|
|
61
|
-
if @room.update_attributes(
|
66
|
+
if @room.update_attributes(room_params)
|
62
67
|
message = t('bigbluebutton_rails.rooms.notice.update.success')
|
63
68
|
format.html {
|
64
|
-
|
69
|
+
redirect_to_using_params bigbluebutton_room_path(@room), :notice => message
|
65
70
|
}
|
66
71
|
format.json { render :json => { :message => message } }
|
67
72
|
else
|
68
73
|
format.html {
|
69
|
-
|
70
|
-
|
71
|
-
redirect_to params[:redir_url]
|
72
|
-
else
|
73
|
-
render :edit
|
74
|
-
end
|
74
|
+
message = t('bigbluebutton_rails.rooms.notice.update.failure')
|
75
|
+
redirect_to_params_or_render :edit, :error => message
|
75
76
|
}
|
76
77
|
format.json { render :json => @room.errors.full_messages, :status => :unprocessable_entity }
|
77
78
|
end
|
@@ -95,7 +96,7 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
95
96
|
respond_with do |format|
|
96
97
|
format.html {
|
97
98
|
flash[:error] = message if error
|
98
|
-
|
99
|
+
redirect_to_using_params bigbluebutton_rooms_url
|
99
100
|
}
|
100
101
|
format.json {
|
101
102
|
if error
|
@@ -107,19 +108,10 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
107
108
|
end
|
108
109
|
end
|
109
110
|
|
110
|
-
# Used
|
111
|
+
# Used to join users into a meeting. Most of the work is done in before filters.
|
112
|
+
# Can be called via GET or POST and accepts parameters both in the POST data and URL.
|
111
113
|
def join
|
112
|
-
@user_role
|
113
|
-
if @user_role.nil?
|
114
|
-
raise BigbluebuttonRails::RoomAccessDenied.new
|
115
|
-
|
116
|
-
# anonymous users or users with the role :password join through #invite
|
117
|
-
elsif bigbluebutton_user.nil? or @user_role == :password
|
118
|
-
redirect_to :action => :invite, :mobile => params[:mobile]
|
119
|
-
|
120
|
-
else
|
121
|
-
join_internal(bigbluebutton_user.name, @user_role, bigbluebutton_user.id, :join)
|
122
|
-
end
|
114
|
+
join_internal(@user_name, @user_role, @user_id)
|
123
115
|
end
|
124
116
|
|
125
117
|
# Used to join private rooms or to invite anonymous users (not logged)
|
@@ -136,82 +128,6 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
136
128
|
end
|
137
129
|
end
|
138
130
|
|
139
|
-
# Authenticates an user using name and password passed in the params from #invite
|
140
|
-
# Uses params[:id] to get the target room
|
141
|
-
def auth
|
142
|
-
@room = BigbluebuttonRoom.find_by_param(params[:id]) unless params[:id].blank?
|
143
|
-
if @room.nil?
|
144
|
-
message = t('bigbluebutton_rails.rooms.errors.auth.wrong_params')
|
145
|
-
redirect_to :back, :notice => message
|
146
|
-
return
|
147
|
-
end
|
148
|
-
|
149
|
-
# gets the user information, given priority to a possible logged user
|
150
|
-
name = bigbluebutton_user.nil? ? params[:user][:name] : bigbluebutton_user.name
|
151
|
-
id = bigbluebutton_user.nil? ? nil : bigbluebutton_user.id
|
152
|
-
# the role: nil means access denied, :password means check the room
|
153
|
-
# password, otherwise just use it
|
154
|
-
@user_role = bigbluebutton_role(@room)
|
155
|
-
if @user_role.nil?
|
156
|
-
raise BigbluebuttonRails::RoomAccessDenied.new
|
157
|
-
elsif @user_role == :password
|
158
|
-
role = @room.user_role(params[:user])
|
159
|
-
else
|
160
|
-
role = @user_role
|
161
|
-
end
|
162
|
-
|
163
|
-
unless role.nil? or name.nil? or name.empty?
|
164
|
-
join_internal(name, role, id, :invite)
|
165
|
-
else
|
166
|
-
flash[:error] = t('bigbluebutton_rails.rooms.errors.auth.failure')
|
167
|
-
render :invite, :status => :unauthorized
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
# receives :server_id to indicate the server and :meeting to indicate the
|
172
|
-
# MeetingID of the meeting that should be joined
|
173
|
-
def external
|
174
|
-
if params[:meeting].blank?
|
175
|
-
message = t('bigbluebutton_rails.rooms.errors.external.blank_meetingid')
|
176
|
-
redirect_to params[:redir_url] ||= bigbluebutton_rooms_path, :notice => message
|
177
|
-
end
|
178
|
-
@room = BigbluebuttonRoom.new(:server => @server, :meetingid => params[:meeting])
|
179
|
-
end
|
180
|
-
|
181
|
-
# Authenticates an user using name and password passed in the params from #external
|
182
|
-
# Uses params[:meeting] to get the meetingID of the target room
|
183
|
-
def external_auth
|
184
|
-
# check :meeting and :user
|
185
|
-
if !params[:meeting].blank? && !params[:user].blank?
|
186
|
-
@server.fetch_meetings
|
187
|
-
@room = @server.meetings.select{ |r| r.meetingid == params[:meeting] }.first
|
188
|
-
message = t('bigbluebutton_rails.rooms.errors.external.inexistent_meeting') if @room.nil?
|
189
|
-
else
|
190
|
-
message = t('bigbluebutton_rails.rooms.errors.external.wrong_params')
|
191
|
-
end
|
192
|
-
|
193
|
-
unless message.nil?
|
194
|
-
@room = nil
|
195
|
-
redirect_to :back, :notice => message
|
196
|
-
return
|
197
|
-
end
|
198
|
-
|
199
|
-
# This is just to check if the room is not blocked, not to get the actual role
|
200
|
-
raise BigbluebuttonRails::RoomAccessDenied.new if bigbluebutton_role(@room).nil?
|
201
|
-
|
202
|
-
# if there's a user logged, use his name instead of the name in the params
|
203
|
-
name = bigbluebutton_user.nil? ? params[:user][:name] : bigbluebutton_user.name
|
204
|
-
id = bigbluebutton_user.nil? ? nil : bigbluebutton_user.id
|
205
|
-
role = @room.user_role(params[:user])
|
206
|
-
|
207
|
-
unless role.nil? or name.nil? or name.empty?
|
208
|
-
join_internal(name, role, id, :external)
|
209
|
-
else
|
210
|
-
flash[:error] = t('bigbluebutton_rails.rooms.errors.auth.failure')
|
211
|
-
render :external, :status => :unauthorized
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
131
|
def running
|
216
132
|
begin
|
217
133
|
@room.fetch_is_running?
|
@@ -243,14 +159,14 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
243
159
|
respond_with do |format|
|
244
160
|
format.html {
|
245
161
|
flash[:error] = message
|
246
|
-
|
162
|
+
redirect_to_using_params :back
|
247
163
|
}
|
248
164
|
format.json { render :json => message, :status => :error }
|
249
165
|
end
|
250
166
|
else
|
251
167
|
respond_with do |format|
|
252
168
|
format.html {
|
253
|
-
|
169
|
+
redirect_to_using_params bigbluebutton_room_path(@room), :notice => message
|
254
170
|
}
|
255
171
|
format.json { render :json => message }
|
256
172
|
end
|
@@ -259,13 +175,9 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
259
175
|
end
|
260
176
|
|
261
177
|
def join_mobile
|
262
|
-
|
263
|
-
@
|
264
|
-
|
265
|
-
# TODO: we can't use the mconf url because the mobile client scanning the qrcode is not
|
266
|
-
# logged. so we are using the full BBB url for now.
|
267
|
-
@qrcode_url = @room.join_url(bigbluebutton_user.name, bigbluebutton_role(@room))
|
268
|
-
@qrcode_url.gsub!(/http:\/\//i, "bigbluebutton://")
|
178
|
+
filtered_params = select_params_for_join_mobile(params.clone)
|
179
|
+
@join_mobile = join_bigbluebutton_room_url(@room, filtered_params.merge({:auto_join => '1' }))
|
180
|
+
@join_desktop = join_bigbluebutton_room_url(@room, filtered_params.merge({:desktop => '1' }))
|
269
181
|
end
|
270
182
|
|
271
183
|
def fetch_recordings
|
@@ -273,7 +185,7 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
273
185
|
|
274
186
|
if @room.server.nil?
|
275
187
|
error = true
|
276
|
-
message = t('bigbluebutton_rails.rooms.
|
188
|
+
message = t('bigbluebutton_rails.rooms.errors.fetch_recordings.no_server')
|
277
189
|
else
|
278
190
|
begin
|
279
191
|
# filter only recordings created by this room
|
@@ -289,13 +201,13 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
289
201
|
respond_with do |format|
|
290
202
|
format.html {
|
291
203
|
flash[error ? :error : :notice] = message
|
292
|
-
|
204
|
+
redirect_to_using_params bigbluebutton_room_path(@room)
|
293
205
|
}
|
294
206
|
format.json {
|
295
207
|
if error
|
296
208
|
render :json => { :message => message }, :status => :error
|
297
209
|
else
|
298
|
-
|
210
|
+
render :json => true, :status => :ok
|
299
211
|
end
|
300
212
|
}
|
301
213
|
end
|
@@ -311,47 +223,152 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
311
223
|
@room = BigbluebuttonRoom.find_by_param(params[:id])
|
312
224
|
end
|
313
225
|
|
314
|
-
def find_server
|
315
|
-
@server = BigbluebuttonServer.find(params[:server_id])
|
316
|
-
end
|
317
|
-
|
318
226
|
def set_request_headers
|
319
227
|
unless @room.nil?
|
320
228
|
@room.request_headers["x-forwarded-for"] = request.remote_ip
|
321
229
|
end
|
322
230
|
end
|
323
231
|
|
324
|
-
def
|
232
|
+
def join_check_room
|
233
|
+
@room = BigbluebuttonRoom.find_by_param(params[:id]) unless params[:id].blank?
|
234
|
+
if @room.nil?
|
235
|
+
message = t('bigbluebutton_rails.rooms.errors.join.wrong_params')
|
236
|
+
redirect_to :back, :notice => message
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
# Checks the parameters received when calling `join` and sets them in variables to
|
241
|
+
# be accessed by other methods. Sets the user's name, id and role. Gives priority to
|
242
|
+
# a logged user over the information provided in the params.
|
243
|
+
def join_user_params
|
244
|
+
# gets the user information, given priority to a possible logged user
|
245
|
+
if bigbluebutton_user.nil?
|
246
|
+
@user_name = params[:user].blank? ? nil : params[:user][:name]
|
247
|
+
@user_id = nil
|
248
|
+
else
|
249
|
+
@user_name = bigbluebutton_user.name
|
250
|
+
@user_id = bigbluebutton_user.id
|
251
|
+
end
|
252
|
+
|
253
|
+
# the role: nil means access denied, :password means check the room
|
254
|
+
# password, otherwise just use it
|
255
|
+
@user_role = bigbluebutton_role(@room)
|
256
|
+
if @user_role.nil?
|
257
|
+
raise BigbluebuttonRails::RoomAccessDenied.new
|
258
|
+
elsif @user_role == :password
|
259
|
+
@user_role = @room.user_role(params[:user])
|
260
|
+
end
|
261
|
+
|
262
|
+
if @user_role.nil? or @user_name.blank?
|
263
|
+
flash[:error] = t('bigbluebutton_rails.rooms.errors.join.failure')
|
264
|
+
redirect_to_on_join_error
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
# Aborts and redirects to an error if the user can't create a meeting in
|
269
|
+
# the room and it needs to be created.
|
270
|
+
def join_check_can_create
|
271
|
+
begin
|
272
|
+
unless @room.fetch_is_running?
|
273
|
+
unless bigbluebutton_can_create?(@room, @user_role)
|
274
|
+
flash[:error] = t('bigbluebutton_rails.rooms.errors.join.cannot_create')
|
275
|
+
redirect_to_on_join_error
|
276
|
+
end
|
277
|
+
end
|
278
|
+
rescue BigBlueButton::BigBlueButtonException => e
|
279
|
+
flash[:error] = e.to_s[0..200]
|
280
|
+
redirect_to_on_join_error
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
# If the user called the join from a mobile device, he will be redirected to
|
285
|
+
# an intermediary page with information about the mobile client. A few flags set
|
286
|
+
# in the params can override this behavior and skip this intermediary page.
|
287
|
+
def join_check_redirect_to_mobile
|
288
|
+
if browser.mobile? &&
|
289
|
+
!BigbluebuttonRails::value_to_boolean(params[:auto_join]) &&
|
290
|
+
!BigbluebuttonRails::value_to_boolean(params[:desktop])
|
291
|
+
|
292
|
+
# since we're redirecting to an intermediary page, we set in the params the params
|
293
|
+
# we received, including the referer, so we can go back to the previous page if needed
|
294
|
+
filtered_params = select_params_for_join_mobile(params.clone)
|
295
|
+
begin
|
296
|
+
filtered_params[:redir_url] = Addressable::URI.parse(request.env["HTTP_REFERER"]).path
|
297
|
+
rescue
|
298
|
+
end
|
299
|
+
|
300
|
+
redirect_to join_mobile_bigbluebutton_room_path(@room, filtered_params)
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
# Selects the params from `params` that should be passed in a redirect to `join_mobile` and
|
305
|
+
# adds new parameters that might be needed.
|
306
|
+
def select_params_for_join_mobile(params)
|
307
|
+
params.blank? ? {} : params.slice("user", "redir_url")
|
308
|
+
end
|
309
|
+
|
310
|
+
# Default method to redirect after an error in the action `join`.
|
311
|
+
def redirect_to_on_join_error
|
312
|
+
redirect_to_using_params_or_back(invite_bigbluebutton_room_path(@room))
|
313
|
+
end
|
314
|
+
|
315
|
+
# The internal process to join a meeting.
|
316
|
+
def join_internal(username, role, id)
|
325
317
|
begin
|
326
318
|
# first check if we have to create the room and if the user can do it
|
327
|
-
@room.fetch_is_running?
|
328
|
-
unless @room.is_running?
|
319
|
+
unless @room.fetch_is_running?
|
329
320
|
if bigbluebutton_can_create?(@room, role)
|
330
|
-
@room
|
321
|
+
user_opts = bigbluebutton_create_options(@room)
|
322
|
+
@room.create_meeting(bigbluebutton_user, request, user_opts)
|
331
323
|
else
|
332
|
-
flash[:error] = t('bigbluebutton_rails.rooms.errors.
|
333
|
-
|
324
|
+
flash[:error] = t('bigbluebutton_rails.rooms.errors.join.cannot_create')
|
325
|
+
redirect_to_on_join_error
|
334
326
|
return
|
335
327
|
end
|
336
328
|
end
|
337
329
|
|
330
|
+
# gets the token with the configurations for this user/room
|
331
|
+
token = @room.fetch_new_token
|
332
|
+
options = if token.nil? then {} else { :configToken => token } end
|
333
|
+
|
338
334
|
# room created and running, try to join it
|
339
|
-
url = @room.join_url(username, role)
|
335
|
+
url = @room.join_url(username, role, nil, options)
|
340
336
|
unless url.nil?
|
341
|
-
|
342
|
-
|
343
|
-
|
337
|
+
|
338
|
+
# change the protocol to join with a mobile device
|
339
|
+
if browser.mobile? && !BigbluebuttonRails::value_to_boolean(params[:desktop])
|
340
|
+
url.gsub!(/^[^:]*:\/\//i, "bigbluebutton://")
|
344
341
|
end
|
345
|
-
|
342
|
+
|
343
|
+
# enqueue an update in the meetings for later on
|
344
|
+
# note: this is the only update that is not in the model, but has to be here
|
345
|
+
# because the model doesn't know when a user joined a room
|
346
|
+
Resque.enqueue(::BigbluebuttonMeetingUpdater, @room.id, 15.seconds)
|
347
|
+
|
348
|
+
redirect_to url
|
346
349
|
else
|
347
|
-
flash[:error] = t('bigbluebutton_rails.rooms.errors.
|
348
|
-
|
350
|
+
flash[:error] = t('bigbluebutton_rails.rooms.errors.join.not_running')
|
351
|
+
redirect_to_on_join_error
|
349
352
|
end
|
350
353
|
|
351
354
|
rescue BigBlueButton::BigBlueButtonException => e
|
352
355
|
flash[:error] = e.to_s[0..200]
|
353
|
-
|
356
|
+
redirect_to_on_join_error
|
354
357
|
end
|
355
358
|
end
|
356
359
|
|
360
|
+
def room_params
|
361
|
+
unless params[:bigbluebutton_room].nil?
|
362
|
+
params[:bigbluebutton_room].permit(*room_allowed_params)
|
363
|
+
else
|
364
|
+
[]
|
365
|
+
end
|
366
|
+
end
|
367
|
+
|
368
|
+
def room_allowed_params
|
369
|
+
[ :name, :server_id, :meetingid, :attendee_password, :moderator_password, :welcome_msg,
|
370
|
+
:private, :logout_url, :dial_number, :voice_bridge, :max_participants, :owner_id,
|
371
|
+
:owner_type, :external, :param, :record, :duration, :default_layout, :presenter_share_only,
|
372
|
+
:auto_start_video, :auto_start_audio, :metadata_attributes => [ :id, :name, :content, :_destroy, :owner_id ] ]
|
373
|
+
end
|
357
374
|
end
|