Permalink
Browse files

let students join inactive long-running conferences, fixes #7454

added a :resume permission so participants can join long-running
conferences even if they go inactive

test plan:
1. set up wimba (or bbb)
2. create a conference with a duration
3. confirm that students can't join unless it's active (in the case of
   wimba, that means an admin needs to be in the conference. for bbb,
   an admin needs to have been present in the last hour)
4. create a long running conference (no duration)
5. confirm that students can join any time after it was started,
   regardless of whether the admin is still participating

Change-Id: Ie81ea7309b6334d88269af098f3b0da6fb04a177
Reviewed-on: https://gerrit.instructure.com/9433
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
  • Loading branch information...
1 parent 76496a4 commit af9587874e3ab5af05c95580d9a1354c7779bd00 @jenseng jenseng committed Mar 15, 2012
@@ -102,7 +102,7 @@ def join
redirect_to named_context_url(@context, :context_conferences_url)
return
end
- if @conference.grants_right?(@current_user, session, :initiate) || @conference.active?(true)
+ if @conference.grants_right?(@current_user, session, :initiate) || @conference.grants_right?(@current_user, session, :resume) || @conference.active?(true)
@conference.add_attendee(@current_user)
@conference.restart if @conference.ended_at && @conference.grants_right?(@current_user, session, :initiate)
log_asset_access(@conference, "conferences", "conferences", 'participate')
@@ -354,6 +354,9 @@ def clone_for(context, dup=nil, options={})
given { |user, session| self.users.include?(user) && self.cached_context_grants_right?(user, session, :read) }
can :read and can :join
+ given { |user, session| self.users.include?(user) && self.cached_context_grants_right?(user, session, :read) && long_running? && active? }
+ can :resume
+
given { |user, session| (self.is_public rescue false) }
can :read and can :join
@@ -22,7 +22,7 @@
before do
# these specs need an enabled web conference plugin
@plugin = PluginSetting.find_or_create_by_name('dim_dim')
- @plugin.update_attribute(:settings, { :domain => 'www.example.com' })
+ @plugin.update_attribute(:settings, { :domain => 'dimdim.test' })
end
describe "GET 'index'" do
@@ -83,5 +83,53 @@
response.should be_success
end
end
-
+
+ describe "POST 'join'" do
+ it "should require authorization" do
+ course_with_teacher(:active_all => true)
+ @conference = @course.web_conferences.create(:conference_type => 'DimDim', :duration => 60)
+ post 'join', :course_id => @course.id, :conference_id => @conference.id
+ assert_unauthorized
+ end
+
+ it "should let admins join a conference" do
+ course_with_teacher_logged_in(:active_all => true, :user => user_with_pseudonym(:active_all => true))
+ @conference = @course.web_conferences.create(:conference_type => 'DimDim', :duration => 60)
+ post 'join', :course_id => @course.id, :conference_id => @conference.id
+ response.should be_redirect
+ response['Location'].should =~ /dimdim\.test/
+ end
+
+ it "should let students join an inactive long running conference" do
+ course_with_student_logged_in(:active_all => true, :user => user_with_pseudonym(:active_all => true))
+ @conference = @course.web_conferences.create(:conference_type => 'DimDim')
+ @conference.update_attribute :start_at, 1.month.ago
+ @conference.users << @user
+ DimDimConference.any_instance.stubs(:conference_status).returns(:closed)
+ post 'join', :course_id => @course.id, :conference_id => @conference.id
+ response.should be_redirect
+ response['Location'].should =~ /dimdim\.test/
+ end
+
+ it "should let students join an active conference" do
+ course_with_student_logged_in(:active_all => true, :user => user_with_pseudonym(:active_all => true))
+ @conference = @course.web_conferences.create(:conference_type => 'DimDim', :duration => 60)
+ @conference.users << @user
+ DimDimConference.any_instance.expects(:active?).returns(true)
+ post 'join', :course_id => @course.id, :conference_id => @conference.id
+ response.should be_redirect
+ response['Location'].should =~ /dimdim\.test/
+ end
+
+ it "should not let students join an inactive conference" do
+ course_with_student_logged_in(:active_all => true, :user => user_with_pseudonym(:active_all => true))
+ @conference = @course.web_conferences.create(:conference_type => 'DimDim', :duration => 60)
+ @conference.users << @user
+ DimDimConference.any_instance.expects(:active?).returns(false)
+ post 'join', :course_id => @course.id, :conference_id => @conference.id
+ response.should be_redirect
+ response['Location'].should_not =~ /dimdim\.test/
+ flash[:notice].should match(/That conference is not currently active/)
+ end
+ end
end

0 comments on commit af95878

Please sign in to comment.