<commit_before>class InstitutionsController < ApplicationController
  inherit_resources
  before_filter :set_institution, only: [:show, :edit, :update, :destroy]
  load_and_authorize_resource
  before_filter :authenticate_user!

  include Blacklight::SolrHelper

  def destroy
    name = @institution.name
    destroy!(notice: "#{name} was successfully destroyed.")
  end

  private

    def set_institution
      @institution = params[:institution_identifier].nil? ? current_user.institution : Institution.where(desc_metadata__institution_identifier_tesim: params[:institution_identifier]).first
      authorize! :read, @institution
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def build_resource_params
      params[:action] == 'new' ? [] : [params.require(:institution).permit(:name, :institution_identifier)]
    end

end<commit_msg>Explicitly authorizing each controller method on Insitutions.<commit_after>class InstitutionsController < ApplicationController
  inherit_resources
  before_filter :set_institution, only: [:show, :edit, :update, :destroy]
  before_filter :authenticate_user!

  include Blacklight::SolrHelper

  def destroy
    authorize! :destory, @institution
    name = @institution.name
    destroy!(notice: "#{name} was successfully destroyed.")
  end

  def show
    authorize! :read, @institution
  end

  def edit
    authorize! :edit, @institution
  end

  def update
    authorize! :update, @institution
  end

  private

    def set_institution
      @institution = params[:institution_identifier].nil? ? current_user.institution : Institution.where(desc_metadata__institution_identifier_tesim: params[:institution_identifier]).first
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def build_resource_params
      params[:action] == 'new' ? [] : [params.require(:institution).permit(:name, :institution_identifier)]
    end

end
{'fraction_non_alphanumeric': 0.08883248730964467, 'fraction_numerical': 0.0, 'mean_word_length': 4.831360946745562, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3388558', 'n_tokens_mistral': 558, 'n_tokens_neox': 537, 'n_words': 140}