<commit_before>class EcAlertsController < ApplicationController
  unloadable
  before_filter :check_authorization , :only => [:index , :create]

  def index
    @members = User.where('mail != ?' , '')
  end


  def update
    members = Array(params[:members])

    if members.length == 0
      redirect_to :back
      return
    end

    users = User.where(tracking=true)

    users.each do |user|
      user.tracking = false
      user.save
    end

    members.each do |user|
      user = User.find(id=user.to_i)
      user.tracking = true
      user.save
    end

    redirect_to :back
  end

  private

  def check_authorization
    member = Member.where(user_id: User.current).first

    if !member.nil?
      if member.roles.count > 0

        member.roles.each do |role|
          if role.has_permission?(:manage_el_capitan)
            return true
          end
        end
      end
    end
    render '403'
  end
end<commit_msg>Config tracking<commit_after>class EcAlertsController < ApplicationController
  unloadable
  before_filter :check_authorization , :only => [:index , :create]

  def index
    @members = User.where('mail != ?' , '')
  end


  def update
    members = Array(params[:members])

    if members.length == 0
      flash[:error] = l(:ec_members_not_selected)
      redirect_to :back
      return
    end

    users = User.where(tracking=true)

    users.each do |user|
      user.tracking = false
      user.save
    end

    members.each do |user|
      user = User.find(id=user.to_i)
      user.tracking = true
      user.save
    end

    flash[:notice] = l(:ec_config_saved)
    redirect_to :back
  end

  private

  def check_authorization
    member = Member.where(user_id: User.current).first

    if !member.nil?
      if member.roles.count > 0

        member.roles.each do |role|
          if role.has_permission?(:manage_el_capitan)
            return true
          end
        end
      end
    end
    render '403'
  end
end
{'fraction_non_alphanumeric': 0.09344845099035043, 'fraction_numerical': 0.005078720162519045, 'mean_word_length': 2.2295081967213113, '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': '5987101', 'n_tokens_mistral': 648, 'n_tokens_neox': 607, 'n_words': 148}