<commit_before>class ApplicationController < ActionController::Base
  before_filter :authenticate_beta_user

  rescue_from CanCan::AccessDenied do |exception|
    redirect_to root_path, :alert => exception.message
  end

  def auth_token
    request.headers['auth_token']
  end

  def authenticate_beta_user
    authenticate_user! if ENV['CLOSED_BETA_AUTHENTICATION'] == 'on'
  end

  # Method name must match with `config.authentication_method`
  # in `config/initializers/active_admin.rb`
  def authenticate_active_admin_user!
    authenticate_user!
    unless current_user.has_role? :superadmin
      flash[:alert] = t("errors.authorization_denied")
      redirect_to root_path
    end
  end

end<commit_msg>Configure individual after_sign_path for superadmin and other users.<commit_after>class ApplicationController < ActionController::Base
  before_filter :authenticate_beta_user

  rescue_from CanCan::AccessDenied do |exception|
    redirect_to root_path, :alert => exception.message
  end

  def auth_token
    request.headers['auth_token']
  end

  def authenticate_beta_user
    authenticate_user! if ENV['CLOSED_BETA_AUTHENTICATION'] == 'on'
  end

  # Method name must match with `config.authentication_method`
  # in `config/initializers/active_admin.rb`
  def authenticate_active_admin_user!
    authenticate_user!
    unless current_user.has_role? :superadmin
      flash[:alert] = t("errors.authorization_denied")
      redirect_to root_path
    end
  end

  # Path for redirection after user sign-in, depending on role.
  # Works for Devise sign-in form at least.
  def after_sign_in_path_for(user)
    (user.has_role? :superadmin) ? admin_dashboard_path : root_path
  end

end
{'fraction_non_alphanumeric': 0.07374631268436578, 'fraction_numerical': 0.0, 'mean_word_length': 4.691275167785235, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7545492', 'n_tokens_mistral': 539, 'n_tokens_neox': 524, 'n_words': 121}