<commit_before>require 'miga'
require 'miga/daemon'

class ProjectsController < ApplicationController
  before_action :set_project,
    only: [:destroy, :show, :search, :reference_datasets,
      :medoid_clade, :medoid_clade_as,
      :rdp_classify, :rdp_classify_as, :new_ncbi_download,
      :show_dataset, :result, :result_partial, :reference_dataset_result,
      :daemon_toggle, :new_reference, :create_reference, :progress]
  before_action :logged_in_user, only: [:result]
  before_action :admin_user,
    only: [:lair, :lair_toggle, :daemon_toggle,
      :daemon_start_all, :daemon_stop_all, :daemon_action_all,
      :discovery, :link, :delete_ref_dataset]
  if Settings.user_projects
    before_action(
      Settings.user_create_projects ? :logged_in_user : :admin_user,
      only: [:new, :create]
    )
    before_action :correct_user_or_admin,
      only: [:destroy, :new_ncbi_download, :create_ncbi_download,
        :new_reference, :create_reference, :progress, :delete_ref_dataset]
  else
    before_action :admin_user,
      only: [:new, :create, :destroy, :new_ncbi_download, :create_ncbi_download,
        :new_reference, :create_reference, :progress, :delete_ref_dataset]<commit_msg>fixed a security bug for delete ref_dataset<commit_after>require 'miga'
require 'miga/daemon'

class ProjectsController < ApplicationController
  before_action :set_project,
    only: [:destroy, :show, :search, :reference_datasets,
      :medoid_clade, :medoid_clade_as,
      :rdp_classify, :rdp_classify_as, :new_ncbi_download,
      :show_dataset, :result, :result_partial, :reference_dataset_result,
      :daemon_toggle, :new_reference, :create_reference, :progress]
  before_action :logged_in_user, only: [:result]
  before_action :admin_user,
    only: [:lair, :lair_toggle, :daemon_toggle,
      :daemon_start_all, :daemon_stop_all, :daemon_action_all,
      :discovery, :link, :delete_ref_dataset]
  if Settings.user_projects
    before_action(
      Settings.user_create_projects ? :logged_in_user : :admin_user,
      only: [:new, :create]
    )
    before_action :correct_user_or_admin,
      only: [:destroy, :new_ncbi_download, :create_ncbi_download,
        :new_reference, :create_reference, :progress]
  else
    before_action :admin_user,
      only: [:new, :create, :destroy, :new_ncbi_download, :create_ncbi_download,
        :new_reference, :create_reference, :progress]
{'fraction_non_alphanumeric': 0.10693400167084377, 'fraction_numerical': 0.0, 'mean_word_length': 5.156812339331619, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5510612', 'n_tokens_mistral': 836, 'n_tokens_neox': 811, 'n_words': 153}