adds admin verification to view stats

This commit is contained in:
rgarcia
2015-08-17 22:30:24 +02:00
parent 3a358ed90c
commit 32f2a4f2a1

View File

@@ -1,5 +1,14 @@
class StatsController < ApplicationController class StatsController < ApplicationController
skip_authorization_check
before_action :verify_administrator
def show def show
@event_types = Ahoy::Event.select(:name).uniq.pluck(:name) @event_types = Ahoy::Event.select(:name).uniq.pluck(:name)
end end
private
def verify_administrator
raise CanCan::AccessDenied unless current_user.try(:administrator?)
end
end end