<commit_before>class Maestrano::Auth::SamlController < Maestrano::Rails::SamlBaseController

  def init
    session[:settings] = !!params[:settings]
    super
  end

  #== POST '/maestrano/auth/saml/consume'
  # Final phase of the Single Sign-On handshake. Find or create
  # the required resources (user and group) and sign the user
  # in
  def consume
    params[:tenant] ||= 'default'
    user = Maestrano::Connector::Rails::User.find_or_create_for_maestrano(user_auth_hash, params[:tenant])
    organization = Maestrano::Connector::Rails::Organization.find_or_create_for_maestrano(group_auth_hash, params[:tenant])
    if user && organization
      unless organization.member?(user)
        organization.add_member(user)
      end

      session[:tenant] = params[:tenant]
      session[:uid] = user.uid
      session[:org_uid] = organization.uid
      session[:"role_#{organization.uid}"] = user_group_rel_hash[:role]
    end

    if session[:settings]
      session.delete(:setting)
      redirect_to main_app.root_path
    else
      if current_organization && current_organization.oauth_uid && current_organization.sync_enabled
        redirect_to main_app.home_redirect_to_external_path
      else
        redirect_to main_app.root_path
      end
    end
  end
end<commit_msg>Fixes typo in saml controller<commit_after>class Maestrano::Auth::SamlController < Maestrano::Rails::SamlBaseController

  def init
    session[:settings] = !!params[:settings]
    super
  end

  #== POST '/maestrano/auth/saml/consume'
  # Final phase of the Single Sign-On handshake. Find or create
  # the required resources (user and group) and sign the user
  # in
  def consume
    params[:tenant] ||= 'default'
    user = Maestrano::Connector::Rails::User.find_or_create_for_maestrano(user_auth_hash, params[:tenant])
    organization = Maestrano::Connector::Rails::Organization.find_or_create_for_maestrano(group_auth_hash, params[:tenant])
    if user && organization
      unless organization.member?(user)
        organization.add_member(user)
      end

      session[:tenant] = params[:tenant]
      session[:uid] = user.uid
      session[:org_uid] = organization.uid
      session[:"role_#{organization.uid}"] = user_group_rel_hash[:role]
    end

    if session[:settings]
      session.delete(:settings)
      redirect_to main_app.root_path
    else
      if current_organization && current_organization.oauth_uid && current_organization.sync_enabled
        redirect_to main_app.home_redirect_to_external_path
      else
        redirect_to main_app.root_path
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.0988798764001545, 'fraction_numerical': 0.0, 'mean_word_length': 3.9146110056925996, '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': '3011445', 'n_tokens_mistral': 788, 'n_tokens_neox': 787, 'n_words': 157}