<commit_before>class Hello::ApplicationController < ApplicationController
  include BeforeActions::Controller

  puts "there should be authorization for these controllers"
end<commit_msg>intentionally simplified authorization logic<commit_after>class Hello::ApplicationController < ApplicationController
  include BeforeActions::Controller

  # authorization intentionally simple
  # this code is expected to be rewritten after more core features are developed
  # accepting PR :)
  before_action do
    either = 0
    guest  = 1
    user   = 2

    guest_homepage = hello.root_path
    user_homepage  = hello.user_path

    autho_data = {
      welcome:  {
        index:    guest,
        sign_out: either
      },
      password: {
        #
        sign_up:          guest,
        create:           guest,
        sign_up_welcome:  either,
        #
        sign_in:          guest,
        authenticate:     guest,
        sign_in_welcome:  user,
        #
        forgot:           guest,
        ask:              guest,
        forgot_welcome:   guest,
        #
        reset_token:      guest,
        reset:            guest,
        save:             guest,
      },
      user:       user,
      identities: user,
    }

    autho_c = autho_data[controller_name.to_sym]
    must_be_a = autho_c.is_a?(Hash) ? autho_c[action_name.to_sym] : autho_c

    case must_be_a
    when guest then redirect_to user_homepage  if hello_session.present?
    when user then  redirect_to guest_homepage if hello_session.blank?
    when either # nothing to do, yay
    else
      raise "No Authorization Rules for '#{controller_name}##{action_name}'"
    end
  end


end
{'fraction_non_alphanumeric': 0.06422569027611044, 'fraction_numerical': 0.001800720288115246, 'mean_word_length': 2.1393596986817327, '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': '6263458', 'n_tokens_mistral': 487, 'n_tokens_neox': 482, 'n_words': 124}