Restrict admin controller to admins

This commit is contained in:
Christoph Haas 2018-08-10 16:20:53 +02:00
parent bf96a72158
commit 6182078cdd

View file

@ -1,5 +1,6 @@
class AdminController < ApplicationController
before_action :authenticate_user!
before_action :admin_only
def status
end
@ -20,4 +21,15 @@ class AdminController < ApplicationController
@logs = logs.paginate(page: params[:page], per_page: 20)
end
private
def admin_only
unless current_user.is_admin?
head :forbidden
# redirect_to :back, :alert => "Access denied."
end
end
end