修改《admin可以访问courses和users列表》

Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
alan 2015-01-27 15:29:09 +08:00
parent 36dfd7c77c
commit 5434a5b087
2 changed files with 11 additions and 3 deletions

View File

@ -130,6 +130,7 @@ GEM
rspec (~> 2.11)
hashie (3.3.1)
hike (1.2.3)
hitimes (1.2.2)
hitimes (1.2.2-x86-mingw32)
htmlentities (4.3.2)
i18n (0.6.1)
@ -176,6 +177,10 @@ GEM
cocaine (~> 0.5.3)
mime-types
polyglot (0.3.5)
pry (0.9.12.6)
coderay (~> 1.0)
method_source (~> 0.8)
slop (~> 3.4)
pry (0.9.12.6-x86-mingw32)
coderay (~> 1.0)
method_source (~> 0.8)

View File

@ -8,6 +8,7 @@ class CoursesController < ApplicationController
menu_item :overview
menu_item :feedback, :only => :feedback
menu_item :homework, :only => :homework
menu_item :new_homework, :only => :new_homework
menu_item l(:label_sort_by_time), :only => :index
@ -675,8 +676,10 @@ class CoursesController < ApplicationController
end
def index
render_404 unless User.current.admin?
if !User.current.admin?
render_404
return
end
@course_type = params[:course_type]
@school_id = params[:school_id]
per_page_option = 10
@ -724,7 +727,7 @@ class CoursesController < ApplicationController
respond_to do |format|
format.html {
# render :layout => 'base'
render :layout => 'base'
}
format.atom {
courses = Course.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all