Restrict admin controller to admins
This commit is contained in:
parent
bf96a72158
commit
6182078cdd
1 changed files with 12 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue