课程通知访问增加权限控制

This commit is contained in:
sw 2014-12-05 14:39:03 +08:00
parent d2814b4b47
commit a2537899b7
1 changed files with 19 additions and 15 deletions

View File

@ -65,6 +65,7 @@ class NewsController < ApplicationController
format.atom { render_feed(@newss, :title => (@project ? @project.name : Setting.app_title) + ": #{l(:label_news_plural)}") } format.atom { render_feed(@newss, :title => (@project ? @project.name : Setting.app_title) + ": #{l(:label_news_plural)}") }
end end
elsif @course elsif @course
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
scope = @course ? @course.news.course_visible : News.course_visible scope = @course ? @course.news.course_visible : News.course_visible
@news_count = scope.count @news_count = scope.count
@ -83,6 +84,9 @@ class NewsController < ApplicationController
format.api format.api
format.atom { render_feed(@newss, :title => (@course ? @course.name : Setting.app_title) + ": #{l(:label_news_plural)}") } format.atom { render_feed(@newss, :title => (@course ? @course.name : Setting.app_title) + ": #{l(:label_news_plural)}") }
end end
else
render_403
end
end end
end end