<commit_before>class UserPolicy < ApplicationPolicy
  def read?
    oauth_scoped_disjunction do |d|
      d.add(:read_profile) { user && user == record }
      d.add(:read_organizations) do
        site_admin? ||
          record.user_con_profiles.where(
            convention: conventions_with_organization_permission('read_convention_users')
          ).any?
      end
    end
  end

  def manage?
    oauth_scope?(:manage_organizations) && site_admin?
  end

  def update?
    return true if oauth_scoped_disjunction do |d|
      d.add(:manage_profile) { user && user == record }
    end

    manage?
  end

  def merge?
    manage?
  end

  class Scope < Scope
    def resolve
      return scope.all if site_admin? && oauth_scope?(:read_organizations)

      disjunctive_where do |dw|
        dw.add(id: user.id) if user && oauth_scope?(:read_profile)

        if oauth_scope?(:read_organizations)
          dw.add(
            id: UserConProfile.where(
              convention: conventions_with_organization_permission('read_convention_users')
            ).select(:user_id)
          )
        end
      end
    end
  end
end<commit_msg>Don't require the read_profile scope to read your basic user info<commit_after>class UserPolicy < ApplicationPolicy
  def read?
    return true if user && user == record

    oauth_scoped_disjunction do |d|
      d.add(:read_organizations) do
        site_admin? ||
          record.user_con_profiles.where(
            convention: conventions_with_organization_permission('read_convention_users')
          ).any?
      end
    end
  end

  def manage?
    oauth_scope?(:manage_organizations) && site_admin?
  end

  def update?
    return true if oauth_scoped_disjunction do |d|
      d.add(:manage_profile) { user && user == record }
    end

    manage?
  end

  def merge?
    manage?
  end

  class Scope < Scope
    def resolve
      return scope.all if site_admin? && oauth_scope?(:read_organizations)

      disjunctive_where do |dw|
        dw.add(id: user.id) if user

        if oauth_scope?(:read_organizations)
          dw.add(
            id: UserConProfile.where(
              convention: conventions_with_organization_permission('read_convention_users')
            ).select(:user_id)
          )
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08304347826086957, 'fraction_numerical': 0.0, 'mean_word_length': 2.449775112443778, 'pattern_counts': {'":': 0, '<': 7, '<?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': '488353', 'n_tokens_mistral': 726, 'n_tokens_neox': 695, 'n_words': 164}