<commit_before># -*- encoding : utf-8 -*-
class Jmd::PerformancesController < Jmd::BaseController
  include PerformancesHelper

  filterable_actions = [:index, :make_certificates, :make_jury_sheets]

  load_and_authorize_resource except: filterable_actions
  skip_authorization_check only: filterable_actions

  # helper_method :sort_order

  # Define scopes for entry filtering
  # has_scope :is_popular, only: :make_certificates
  has_scope :in_competition, only: filterable_actions
  has_scope :in_category, only: filterable_actions
  has_scope :in_age_group, only: filterable_actions
  # has_scope :from_host, :only => [:index, :make_certificates, :make_jury_sheets]
  # has_scope :on_date, :only => [:index, :make_certificates, :make_jury_sheets]

  # Manage entries at hosts the user has access to
  def index
    # filter_sort_entries
    # @performances are fetched by CanCan
    @performances = apply_scopes(Performance).accessible_by(current_ability).current
                                             .order("created_at DESC")<commit_msg>Fix security hole caused by missing authorization of filterable actions<commit_after># -*- encoding : utf-8 -*-
class Jmd::PerformancesController < Jmd::BaseController
  include PerformancesHelper

  filterable_actions = [:index, :make_certificates, :make_jury_sheets]

  load_and_authorize_resource # CanCan
  skip_load_resource only: filterable_actions # for custom loading

  # helper_method :sort_order

  # Define scopes for entry filtering
  # has_scope :is_popular, only: :make_certificates
  has_scope :in_competition, only: filterable_actions
  has_scope :in_category, only: filterable_actions
  has_scope :in_age_group, only: filterable_actions
  # has_scope :from_host, :only => [:index, :make_certificates, :make_jury_sheets]
  # has_scope :on_date, :only => [:index, :make_certificates, :make_jury_sheets]

  # Manage entries at hosts the user has access to
  def index
    # filter_sort_entries
    @performances = apply_scopes(Performance).accessible_by(current_ability).current
                                             .order("created_at DESC")
{'fraction_non_alphanumeric': 0.0817966903073286, 'fraction_numerical': 0.0009456264775413711, 'mean_word_length': 4.597883597883598, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3622734', 'n_tokens_mistral': 652, 'n_tokens_neox': 626, 'n_words': 153}