diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 9330d1d44..516b88310 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -148,7 +148,7 @@ class WelcomeController < ApplicationController end private - + # 判断网站的入口,是课程 course 则跳过index去渲染 course 方法 def entry_select url = request.original_url if url.include?("course.trustie.net") @@ -166,28 +166,6 @@ class WelcomeController < ApplicationController end - # 判断网站的入口,是课程 course 则跳过index去渲染 course 方法 - def entry_select_course - if request.original_url.match(/.*course\.trustie\.net/) - (course() and render :course and return 0) - end - end - - def entry_select_contest - if request.original_url.match(/.*contest\.trustie\.net/) - contest - render :contest - return 0 - end - end - - def entry_select_user - if request.original_url.match(/.*user\.trustie\.net$/) - redirect_to(:controller => "users", :action => "index") - return 0 - end - end - # def render(*args) # _fake if @fake_filter # super diff --git a/app/models/project.rb b/app/models/project.rb index 35a360ac3..d6283e44f 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -56,13 +56,12 @@ class Project < ActiveRecord::Base #added by xianbo for delete biding_project has_many :biding_projects, :dependent => :destroy has_many :contesting_projects, :dependent => :destroy - has_many :projecting_softapplications, :dependent => :destroy has_many :softapplications, :through => :projecting_softapplications #ended by xianbo # added by fq has_many :journals_for_messages, :as => :jour, :dependent => :destroy - has_many :homework_for_courses, :dependent => :destroy - has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy + #has_many :homework_for_courses, :dependent => :destroy + #has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy has_many :shares, :dependent => :destroy # has_many :students_for_courses, :dependent => :destroy has_many :student, :through => :students_for_courses, :source => :user diff --git a/test/functional/courses_controller_test.rb b/test/functional/courses_controller_test.rb index a1551a717..7185f6303 100644 --- a/test/functional/courses_controller_test.rb +++ b/test/functional/courses_controller_test.rb @@ -10,6 +10,7 @@ class CoursesControllerTest < ActionController::TestCase Setting.default_language = 'en' end + # Get :index def test_index_by_anonymous_should_not_show_private_projects get :index assert_response :success @@ -19,6 +20,7 @@ class CoursesControllerTest < ActionController::TestCase assert courses.all?(&:is_public?) end + # Get :new # 人员添加课程的权限是不属于任何角色 def test_new_course_anyone_temporary @request.session[:user_id] = 5 @@ -29,6 +31,7 @@ class CoursesControllerTest < ActionController::TestCase assert_template :new end + # post :create def test_create_course_with_access_control @request.session[:user_id] = 5 Role.find_by_name("Non member").add_permission! :add_course #Non member @@ -54,6 +57,7 @@ class CoursesControllerTest < ActionController::TestCase # assert_redirected_to "courses/#{course.id}/settings" end + # post :create 403 def test_create_course_without_access_control @request.session[:user_id] = 5 #Role.find_by_name("Non member").add_permission! :add_course #Non member