私有项目讨论区非项目成员、未登录情况不能访问

redis_cache
huang 10 years ago
parent be834dd334
commit 0123ea32bf

@ -32,13 +32,17 @@ class BoardsController < ApplicationController
#modify by nwb #modify by nwb
@flag = params[:flag] || false @flag = params[:flag] || false
if @project if @project
@boards = @project.boards.includes(:last_message => :author).all if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin?
@boards = [] << @boards[0] if @boards.any? render_403
if @boards.size == 1 else
@board = @boards.first @boards = @project.boards.includes(:last_message => :author).all
show and return @boards = [] << @boards[0] if @boards.any?
if @boards.size == 1
@board = @boards.first
show and return
end
render :layout => false if request.xhr?
end end
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))) 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

@ -677,7 +677,7 @@ class ProjectsController < ApplicationController
end end
def watcherlist def watcherlist
if !@project.is_public? && !User.current.member_of?(@project) if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin?
render_403 render_403
else else
@users -= watched.watcher_users if @watched @users -= watched.watcher_users if @watched

Loading…
Cancel
Save