This repository has been archived on 2021-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
greenlight/app/controllers/application_controller.rb

50 lines
1.3 KiB
Ruby

require 'bigbluebutton_api'
class ApplicationController < ActionController::Base
include SessionsHelper
protect_from_forgery with: :exception
MEETING_NAME_LIMIT = 90
USER_NAME_LIMIT = 30
def meeting_name_limit
MEETING_NAME_LIMIT
end
helper_method :meeting_name_limit
def user_name_limit
USER_NAME_LIMIT
end
helper_method :user_name_limit
# Determines if the BigBlueButton endpoint is configured (or set to default).
def bigbluebutton_endpoint_default?
return false if loadbalanced_configuration?
Rails.configuration.bigbluebutton_endpoint_default == Rails.configuration.bigbluebutton_endpoint
end
helper_method :bigbluebutton_endpoint_default?
def loadbalanced_configuration?
Rails.configuration.loadbalanced_configuration
end
helper_method :loadbalanced_configuration?
def allow_greenlight_users?
Rails.configuration.greenlight_accounts
end
helper_method :allow_greenlight_users?
private
# Ensure the user is logged into the room they are accessing.
def verify_room_ownership
# Redirect to correct room or root if not logged in.
if current_user.nil?
redirect_to root_path
elsif @room.nil? || current_user != @room.user
redirect_to room_path(current_user.room.uid)
end
end
end