From c0b46be54718bc713656359bbcc0acf21ab84449 Mon Sep 17 00:00:00 2001 From: farhatahmad <35435341+farhatahmad@users.noreply.github.com> Date: Wed, 13 Mar 2019 15:56:57 -0400 Subject: [PATCH] Added fix for multitenant error (#394) * Added fix for multitenant error * Fixed issue with room lock when using ldap * Fixed test cases * Fixed rubocop issue * Included internal documentation for LDAP ENV variables --- app/controllers/rooms_controller.rb | 3 ++- app/models/concerns/api_concern.rb | 3 +++ app/models/room.rb | 1 - sample.env | 7 +++++++ spec/controllers/rooms_controller_spec.rb | 2 ++ 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/controllers/rooms_controller.rb b/app/controllers/rooms_controller.rb index a521c5dd..234d8811 100644 --- a/app/controllers/rooms_controller.rb +++ b/app/controllers/rooms_controller.rb @@ -24,7 +24,8 @@ class RoomsController < ApplicationController unless: -> { !Rails.configuration.enable_email_verification } before_action :find_room, except: :create before_action :verify_room_ownership, except: [:create, :show, :join, :logout] - before_action :verify_room_owner_verified, only: [:show, :join] + before_action :verify_room_owner_verified, only: [:show, :join], + unless: -> { !Rails.configuration.enable_email_verification } # POST / def create diff --git a/app/models/concerns/api_concern.rb b/app/models/concerns/api_concern.rb index c338f59e..c0c162be 100644 --- a/app/models/concerns/api_concern.rb +++ b/app/models/concerns/api_concern.rb @@ -18,6 +18,9 @@ module APIConcern extend ActiveSupport::Concern + + RETURNCODE_SUCCESS = "SUCCESS" + def bbb_endpoint Rails.configuration.bigbluebutton_endpoint end diff --git a/app/models/room.rb b/app/models/room.rb index 56558dca..224e1d64 100644 --- a/app/models/room.rb +++ b/app/models/room.rb @@ -27,7 +27,6 @@ class Room < ApplicationRecord belongs_to :owner, class_name: 'User', foreign_key: :user_id - RETURNCODE_SUCCESS = "SUCCESS" META_LISTED = "gl-listed" # Determines if a user owns a room. diff --git a/sample.env b/sample.env index 0deddaa1..a433a281 100644 --- a/sample.env +++ b/sample.env @@ -56,6 +56,13 @@ OFFICE365_SECRET= # # http://docs.bigbluebutton.org/install/greenlight-v2.html#ldap-auth # +# LDAP_SERVER=ldap.example.com +# LDAP_PORT=389 +# LDAP_METHOD=plain +# LDAP_UID=uid +# LDAP_BASE=dc=example,dc=com +# LDAP_BIND_DN=cn=admin,dc=example,dc=com +# LDAP_PASSWORD=password LDAP_SERVER= LDAP_PORT= LDAP_METHOD= diff --git a/spec/controllers/rooms_controller_spec.rb b/spec/controllers/rooms_controller_spec.rb index 904fd145..803a82bb 100644 --- a/spec/controllers/rooms_controller_spec.rb +++ b/spec/controllers/rooms_controller_spec.rb @@ -74,6 +74,7 @@ describe RoomsController, type: :controller do end it "redirects to root if owner of room is not verified" do + allow(Rails.configuration).to receive(:enable_email_verification).and_return(true) @owner.update_attribute(:email_verified, false) post :show, params: { room_uid: @owner.main_room } @@ -162,6 +163,7 @@ describe RoomsController, type: :controller do end it "redirects to root if owner of room is not verified" do + allow(Rails.configuration).to receive(:enable_email_verification).and_return(true) @owner.update_attribute(:email_verified, false) post :join, params: { room_uid: @room, join_name: @owner.name }