<commit_before>class UserPolicy < ApplicationPolicy
  attr_reader :current_user, :model

  def initialize(current_user, model)
    @current_user = current_user
    @user = model
  end

  def index?
    @current_user.superadmin?
  end

  def show?
    @current_user.superadmin? || @current_user == @user
  end

  def new?
    @current_user.superadmin?
  end

  def edit?
    @current_user.superadmin? || @current_user == @user
  end

  def create?
    @current_user.superadmin?
  end

  def update?
    @current_user.superadmin? || @current_user == @user
  end

  def destroy?
    @current_user.admin_or_superadmin? && @current_user != @user
  end
end<commit_msg>adapt user policy, superadmin is not authorized to delete other superadmins<commit_after>class UserPolicy < ApplicationPolicy
  attr_reader :current_user, :model

  def initialize(current_user, model)
    @current_user = current_user
    @user = model
  end

  def index?
    @current_user.superadmin?
  end

  def show?
    @current_user.superadmin? || @current_user == @user
  end

  def new?
    @current_user.superadmin?
  end

  def edit?
    @current_user.superadmin? || @current_user == @user
  end

  def create?
    @current_user.superadmin?
  end

  def update?
    @current_user.superadmin? || @current_user == @user
  end

  def destroy?
    @current_user.superadmin? && !@user.superadmin?
  end
end
{'fraction_non_alphanumeric': 0.0968681718863802, 'fraction_numerical': 0.0, 'mean_word_length': 3.5496688741721854, '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': '744904', 'n_tokens_mistral': 469, 'n_tokens_neox': 450, 'n_words': 110}