<commit_before>class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception
  check_authorization :unless => :active_admin_controller?

  rescue_from ::CanCan::AccessDenied do |exception|
    puts "access denied due to #{exception.inspect}"
    redirect_to root_path, :alert => exception.message
  end

  def current_user
    @current_user ||= session[:user_id] && ::User.find(session[:user_id])
  end
  helper_method :current_user


  def ensure_logged_in
    current_user || redirect_to(root_path)
  end
  helper_method :ensure_logged_in

  def set_locale
    I18n.locale = if params[:lang].present?
      params[:lang]
    elsif current_user.present?
      current_user.language
    elsif respond_to?(:current_circle) && current_circle.present?
      current_circle.language
    else
     I18n.default_locale
   end
   logger.info "Using locale #{::I18n.locale}"
  end
  before_action :set_locale

  def login user
    session[:user_id] = user.id
  end

  def logout
    session.clear
  end

  def authenticate_admin_user!
    redirect_to root_path unless (current_user and current_user.is_admin?)
  end

  helper_method def filter_present?
    params.has_key? :working_group
  end

  helper_method def errors
    @errors ||= ::Errors.new
  end

  private
  def active_admin_controller?
    controller_path.starts_with? "admin/"
  end

end
<commit_msg>permit params for active admin<commit_after>class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception
  check_authorization :unless => :active_admin_controller?
  before_action :permit_all_params, if: :active_admin_controller?

  rescue_from ::CanCan::AccessDenied do |exception|
    puts "access denied due to #{exception.inspect}"
    redirect_to root_path, :alert => exception.message
  end

  def current_user
    @current_user ||= session[:user_id] && ::User.find(session[:user_id])
  end
  helper_method :current_user


  def ensure_logged_in
    current_user || redirect_to(root_path)
  end
  helper_method :ensure_logged_in

  def set_locale
    I18n.locale = if params[:lang].present?
      params[:lang]
    elsif current_user.present?
      current_user.language
    elsif respond_to?(:current_circle) && current_circle.present?
      current_circle.language
    else
     I18n.default_locale
   end
   logger.info "Using locale #{::I18n.locale}"
  end
  before_action :set_locale

  def login user
    session[:user_id] = user.id
  end

  def logout
    session.clear
  end

  def authenticate_admin_user!
    redirect_to root_path unless (current_user and current_user.is_admin?)
  end

  helper_method def filter_present?
    params.has_key? :working_group
  end

  helper_method def errors
    @errors ||= ::Errors.new
  end

  private
  def active_admin_controller?
    controller_path.starts_with? "admin/"
  end

  def permit_all_params
    params.permit! # allow all parameters
  end
end

{'fraction_non_alphanumeric': 0.0805735745988392, 'fraction_numerical': 0.004096961420279959, 'mean_word_length': 4.017123287671233, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6426641', 'n_tokens_mistral': 950, 'n_tokens_neox': 920, 'n_words': 215}