Authorisation management using CanCanCan added

This commit is contained in:
Christoph Haas 2021-02-28 21:36:46 +01:00
parent 51be4a4777
commit 7a3b65fe50
24 changed files with 211 additions and 295 deletions

View file

@ -1,38 +1,38 @@
class AdminController < ApplicationController
before_action :authenticate_user!
before_action :admin_only
# before_action :authenticate_user!
# before_action :admin_only
def status
end
# def status
# end
def screenshots
end
# def screenshots
# end
def integration
end
# def integration
# end
def moderate_list
end
# def moderate_list
# end
def logs
logs = Log
# def logs
# logs = Log
if params[:search].present?
logger.debug "Searching for #{params[:search]}"
logs = logs.where("message ilike ?", "%#{params[:search]}%")
end
# if params[:search].present?
# logger.debug "Searching for #{params[:search]}"
# logs = logs.where("message ilike ?", "%#{params[:search]}%")
# end
@logs = logs.paginate(page: params[:page], per_page: 20)
end
# @logs = logs.paginate(page: params[:page], per_page: 20)
# end
private
# private
def admin_only
unless current_user.is_admin?
head :forbidden
# redirect_to :back, :alert => "Access denied."
end
end
# def admin_only
# unless current_user.is_admin?
# head :forbidden
# # redirect_to :back, :alert => "Access denied."
# end
# end
end