Skip to content

Commit

Permalink
Merge pull request #957 from mconf/feature-authenticated-recording-urls
Browse files Browse the repository at this point in the history
Adding a config variable to enable the playback url authentication
  • Loading branch information
daronco authored Feb 22, 2018
2 parents 636e590 + 483f6e3 commit 7faefe3
Show file tree
Hide file tree
Showing 14 changed files with 123 additions and 73 deletions.
5 changes: 5 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,8 @@ MCONF_EMAIL_TRACK_CLICKED=true
# MCONF_OMNIAUTH_FACEBOOK_KEY='yourfacebookkey'
# MCONF_OMNIAUTH_GOOGLE_SECRET='yourgooglesecret'
# MCONF_OMNIAUTH_FACEBOOK_SECRET='yourfacebooksecret'

# Flag to use authentication on playback url
# MCONF_PLAYBACK_URL_AUTH=true
# Show playback pages in an iframe instead of redirecting
# MCONF_PLAYBACK_IFRAME=true
2 changes: 2 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ MCONF_DATABASE_PROD_USERNAME='root'
MCONF_DATABASE_PROD_PASSWORD=''
MCONF_EMAIL_TRACK_OPENED=true
MCONF_EMAIL_TRACK_CLICKED=true
MCONF_PLAYBACK_URL_AUTH=false
MCONF_PLAYBACK_IFRAME=true
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GIT

GIT
remote: https://github.com/mconf/bigbluebutton_rails.git
revision: 820bfeb38ca23de2a89b6cc37f850d626f67e527
revision: 80e517e2c029af4d385308f5ce47174271b30bfa
branch: master
specs:
bigbluebutton_rails (2.2.0)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@import "compass/css3";
@import "definitions";

@import "app/shared/recording_list";

body.custom_bigbluebutton_recordings.play {
padding: 0;
margin: 0;
overflow: hidden;
}
11 changes: 10 additions & 1 deletion app/controllers/custom_bigbluebutton_recordings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@ class CustomBigbluebuttonRecordingsController < Bigbluebutton::RecordingsControl

load_and_authorize_resource :find_by => :recordid, :class => "BigbluebuttonRecording"

layout "manage"
layout :determine_layout

def determine_layout
case params[:action].to_sym
when :play
'base'
else
'manage'
end
end

# TODO: #1087 redirect back after updating the desc of a recording

Expand Down
4 changes: 1 addition & 3 deletions app/helpers/custom_bigbluebutton_playback_types_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ module CustomBigbluebuttonPlaybackTypesHelper
def link_to_playback(recording, playback, options={})
link_params = { type: playback.format_type }

if playback.identifier == 'presentation_video'
if playback.downloadable?
name = if recording.description.blank?
recording.name
else
recording.description
end
options.merge!(download: name.parameterize('_'))
link_params.merge!(name: name.parameterize('_'))
end

if ['presentation_video', 'presentation_export'].include?(playback.identifier)
playback_icon = icon_rec_download
else
playback_icon = icon_rec_play
Expand Down
89 changes: 34 additions & 55 deletions app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
@@ -1,66 +1,45 @@
!!! Strict
%html{:lang => I18n.locale.to_s}
-# Default layout
= content_for :base_content do
- if sidenav_visible?
#sidenav= render :partial => "layouts/sidenav"

%head
%meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-type"}
%title= content_for?(:title) ? yield(:title) : current_site.name
= theme_favico
= csrf_meta_tag
- cls_sidenav = sidenav_visible? ? 'with-sidenav' : 'without-sidenav'
#site{ class: cls_sidenav }
#navbar
= render :partial => 'layouts/navbar'

= stylesheet_link_tag "application_print", :media => "print"
= stylesheet_link_tag "application", :media => "screen, projection"
= stylesheet_link_tag_for_controller :media => "screen, projection"
= stylesheet_link_tag "_development" unless Rails.env == "production"
= stylesheet_link_tag "https://fonts.googleapis.com/css?family=Roboto:300,400,700,900", rel: "stylesheet"
= yield :stylesheets
- if content_for?(:content_notification)
#content-notification
= yield :content_notification

= yield :headers
#content

%body{:class => "#{controller_name_for_view} #{params[:action]} #{layout_name} #{theme_class}"}
- if sidenav_visible?
#sidenav= render :partial => "layouts/sidenav"
- if content_for?(:sidebar) || content_for?(:sidebar_menu)
#sidebar
= yield :sidebar
- if content_for?(:sidebar_menu)
#sidebar-menu
= yield :sidebar_menu

- cls_sidenav = sidenav_visible? ? 'with-sidenav' : 'without-sidenav'
#site{ class: cls_sidenav }
#navbar
= render :partial => 'layouts/navbar'
#content-middle

- if content_for?(:content_notification)
#content-notification
= yield :content_notification
-# an internal menu for the page to navigate through sub-pages
- if content_for?(:page_menu)
#page-menu
= yield :page_menu

#content
-# a list of actions for this page (e.g. destroy resource)
- if content_for?(:page_actions)
#page-actions
= yield :page_actions

- if content_for?(:sidebar) || content_for?(:sidebar_menu)
#sidebar
= yield :sidebar
- if content_for?(:sidebar_menu)
#sidebar-menu
= yield :sidebar_menu
-# the actual page content
= yield

#content-middle
#footer-pusher

-# an internal menu for the page to navigate through sub-pages
- if content_for?(:page_menu)
#page-menu
= yield :page_menu
= render :partial => "layouts/footer"
= render :partial => "layouts/analytics"
= render :partial => "layouts/notifications"

-# a list of actions for this page (e.g. destroy resource)
- if content_for?(:page_actions)
#page-actions
= yield :page_actions

-# the actual page content
= yield

#footer-pusher

= render :partial => "layouts/footer"
= render :partial => "layouts/analytics"
= render :partial => "layouts/notifications"

-# Javascript placed at the end of the document so the pages load faster
= javascript_include_tag "application"
= render :partial => 'layouts/javascript_locales'
= javascript_include_tag_for_controller
= yield :javascripts
= render :file => 'layouts/base'
29 changes: 29 additions & 0 deletions app/views/layouts/base.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
!!! Strict
%html{:lang => I18n.locale.to_s}

%head
%meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-type"}
%title= content_for?(:title) ? yield(:title) : current_site.name
= theme_favico
= csrf_meta_tag

= stylesheet_link_tag "application_print", :media => "print"
= stylesheet_link_tag "application", :media => "screen, projection"
= stylesheet_link_tag_for_controller :media => "screen, projection"
= stylesheet_link_tag "_development" unless Rails.env == "production"
= stylesheet_link_tag "https://fonts.googleapis.com/css?family=Roboto:300,400,700,900", rel: "stylesheet"
= yield :stylesheets

= yield :headers

%body{:class => "#{controller_name_for_view} #{params[:action]} #{layout_name} #{theme_class}"}
- if content_for?(:base_content)
= yield :base_content
- else
= yield

-# Javascript placed at the end of the document so the pages load faster
= javascript_include_tag "application"
= render :partial => 'layouts/javascript_locales'
= javascript_include_tag_for_controller
= yield :javascripts
5 changes: 5 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ class Application < Rails::Application
# Set if to false to use the old model based on the `record` flag on the `create` API call.
config.per_user_record_permissions = ENV['MCONF_PER_USER_RECORD_PERMISSIONS'] == 'true'

# Authenticate playback URLs for recordings
config.playback_url_authentication = ENV['MCONF_PLAYBACK_URL_AUTH'] == 'true'
# Show the playback in an iframe. If false, redirects the user to the playback page.
config.playback_iframe = ENV['MCONF_PLAYBACK_IFRAME'] == 'true'

# Themes: configure assets paths here!
# config.assets.paths << Rails.root.join("app", "assets", "themes", "my-theme", "stylesheets")
# config.assets.paths << Rails.root.join("app", "assets", "themes", "my-theme", "images")
Expand Down
2 changes: 2 additions & 0 deletions config/initializers/bigbluebutton_rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

BigbluebuttonRails.configure do |config|
config.guest_support = true
config.playback_url_authentication = Rails.application.config.playback_url_authentication
config.playback_iframe = Rails.application.config.playback_iframe

# Set the invitation URL to the full URL of the room
config.get_invitation_url = Proc.new do |room|
Expand Down
4 changes: 4 additions & 0 deletions db/migrate/20171114142537_bigbluebutton_rails_to230.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ class BigbluebuttonRailsTo230 < ActiveRecord::Migration
def up
rename_column :bigbluebutton_rooms, :param, :slug
rename_column :bigbluebutton_servers, :param, :slug
add_column :bigbluebutton_recordings, :recording_users, :text
add_column :bigbluebutton_playback_types, :downloadable, :boolean, default: false
end

def down
remove_column :bigbluebutton_playback_types, :downloadable
rename_column :bigbluebutton_servers, :slug, :param
rename_column :bigbluebutton_rooms, :slug, :param
remove_column :bigbluebutton_recordings, :recording_users
end
end
16 changes: 9 additions & 7 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,11 @@

create_table "bigbluebutton_playback_types", force: true do |t|
t.string "identifier"
t.boolean "visible", default: false
t.boolean "default", default: false
t.boolean "visible", default: false
t.boolean "default", default: false
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "downloadable", default: false
end

create_table "bigbluebutton_recordings", force: true do |t|
Expand All @@ -120,15 +121,16 @@
t.string "recordid"
t.string "meetingid"
t.string "name"
t.boolean "published", default: false
t.boolean "available", default: true
t.boolean "published", default: false
t.boolean "available", default: true
t.datetime "created_at"
t.datetime "updated_at"
t.text "description"
t.integer "meeting_id"
t.integer "size", limit: 8, default: 0
t.decimal "start_time", precision: 14, scale: 0
t.decimal "end_time", precision: 14, scale: 0
t.integer "size", limit: 8, default: 0
t.decimal "start_time", precision: 14, scale: 0
t.decimal "end_time", precision: 14, scale: 0
t.text "recording_users"
end

add_index "bigbluebutton_recordings", ["recordid"], name: "index_bigbluebutton_recordings_on_recordid", unique: true, using: :btree
Expand Down
1 change: 1 addition & 0 deletions spec/factories/bigbluebutton_playback_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
pbt.sequence(:identifier) { |n| "#{Forgery(:name).first_name.downcase}-#{n}" }
pbt.visible true
pbt.default false
pbt.downloadable false
end
end
16 changes: 10 additions & 6 deletions spec/helpers/custom_bigbluebutton_playback_types_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
describe "#link_to_playback" do
let(:recording) { FactoryGirl.create(:bigbluebutton_recording) }
let(:presentation) { FactoryGirl.create(:bigbluebutton_playback_type, identifier: "presentation") }
let(:presentation_export) { FactoryGirl.create(:bigbluebutton_playback_type, identifier: "presentation_export") }
let(:presentation_video) { FactoryGirl.create(:bigbluebutton_playback_type, identifier: "presentation_video") }
let(:presentation_export) { FactoryGirl.create(:bigbluebutton_playback_type, identifier: "presentation_export", downloadable: true) }
let(:presentation_video) { FactoryGirl.create(:bigbluebutton_playback_type, identifier: "presentation_video", downloadable: true) }

context "when the identifier was presentation" do
let(:playback) { FactoryGirl.create(:bigbluebutton_playback_format, playback_type: presentation) }
Expand All @@ -27,18 +27,22 @@
it("returns the correctly link") { should eq(link) }
end

context "when the identifier was presentation_export" do
context "when the identifier is presentation_export" do
let(:playback) { FactoryGirl.create(:bigbluebutton_playback_format, playback_type: presentation_export) }
let!(:link) {
link_to icon_rec_download, play_bigbluebutton_recording_path(recording, type: presentation_export.identifier), options_for_tooltip(t("bigbluebutton_rails.playback_types.presentation_export.tip"))
let(:name) { 'my_recording' }
let(:link) {
link_to icon_rec_download, play_bigbluebutton_recording_path(recording, { type: presentation_export.identifier, name: name }), options_for_tooltip(t("bigbluebutton_rails.playback_types.presentation_export.tip"), { download: name })
}
before {
recording.update_attributes(description: 'my recording')
}

subject { link_to_playback(recording, playback) }

it("returns the correctly link") { should eq(link) }
end

context "when the identifier was presentation_video" do
context "when the identifier is presentation_video" do
let(:playback) { FactoryGirl.create(:bigbluebutton_playback_format, playback_type: presentation_video) }
subject { link_to_playback(recording, playback) }

Expand Down

0 comments on commit 7faefe3

Please sign in to comment.