pundit: add missing authorize calls.
This commit is contained in:
@@ -13,7 +13,7 @@ class ForumPostsController < ApplicationController
|
||||
end
|
||||
|
||||
def index
|
||||
@forum_posts = ForumPost.visible(CurrentUser.user).paginated_search(params)
|
||||
@forum_posts = authorize ForumPost.visible(CurrentUser.user).paginated_search(params)
|
||||
@forum_posts = @forum_posts.includes(:topic, :creator) if request.format.html?
|
||||
|
||||
respond_with(@forum_posts)
|
||||
|
||||
@@ -20,7 +20,7 @@ class ForumTopicsController < ApplicationController
|
||||
params[:search][:order] ||= "sticky" if request.format.html?
|
||||
params[:limit] ||= 40
|
||||
|
||||
@forum_topics = ForumTopic.visible(CurrentUser.user).paginated_search(params)
|
||||
@forum_topics = authorize ForumTopic.visible(CurrentUser.user).paginated_search(params)
|
||||
|
||||
if request.format.atom?
|
||||
@forum_topics = @forum_topics.includes(:creator, :original_post)
|
||||
|
||||
@@ -16,7 +16,7 @@ class IpAddressesController < ApplicationController
|
||||
end
|
||||
|
||||
def show
|
||||
@ip_address = IpAddress.new(ip_addr: params[:id])
|
||||
@ip_address = authorize IpAddress.new(ip_addr: params[:id])
|
||||
@ip_info = @ip_address.lookup.info
|
||||
respond_with(@ip_info)
|
||||
end
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
class ForumPostPolicy < ApplicationPolicy
|
||||
def index?
|
||||
true
|
||||
end
|
||||
|
||||
def show?
|
||||
user.level >= record.topic.min_level
|
||||
end
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
class ForumTopicPolicy < ApplicationPolicy
|
||||
def index?
|
||||
true
|
||||
end
|
||||
|
||||
def show?
|
||||
user.level >= record.min_level
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user