课程留言、讨论区增加权限控制
This commit is contained in:
parent
a2537899b7
commit
dc5be133c2
|
@ -39,6 +39,7 @@ class BoardsController < ApplicationController
|
||||||
end
|
end
|
||||||
render :layout => false if request.xhr?
|
render :layout => false if request.xhr?
|
||||||
elsif @course
|
elsif @course
|
||||||
|
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
|
||||||
@boards = @course.boards.includes(:last_message => :author).all
|
@boards = @course.boards.includes(:last_message => :author).all
|
||||||
@boards = [] << @boards[0] if @boards.any?
|
@boards = [] << @boards[0] if @boards.any?
|
||||||
if @boards.size == 1
|
if @boards.size == 1
|
||||||
|
@ -46,6 +47,10 @@ class BoardsController < ApplicationController
|
||||||
show and return
|
show and return
|
||||||
end
|
end
|
||||||
render :layout => 'base_courses'
|
render :layout => 'base_courses'
|
||||||
|
else
|
||||||
|
render_403
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -669,6 +669,7 @@ class CoursesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def feedback
|
def feedback
|
||||||
|
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
|
||||||
page = params[:page]
|
page = params[:page]
|
||||||
# Find the page of the requested reply
|
# Find the page of the requested reply
|
||||||
@jours = @course.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
@jours = @course.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||||
|
@ -687,6 +688,10 @@ class CoursesController < ApplicationController
|
||||||
format.html{render :layout => 'base_courses'}
|
format.html{render :layout => 'base_courses'}
|
||||||
format.api
|
format.api
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
render_403
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue