<commit_before>class Ability
  include CanCan::Ability

  def initialize(user)
    return unless user

    case user.profile.label
    when 'admin'
      can :manage, 'admin/cache'
      can :manage, 'admin/content'
      can :manage, 'admin/feedback'
      can :manage, 'admin/notes'
      can :manage, 'admin/pages'
      can :manage, 'admin/post_types'
      can :manage, 'admin/redirects'
      can :manage, 'admin/resources'
      can :manage, 'admin/seo'
      can :manage, 'admin/settings'
      can :manage, 'admin/sidebar'
      can :manage, 'admin/tags'
      can :manage, 'admin/themes'
      can :manage, 'admin/users'
    when 'publisher'
      can :manage, 'admin/content'
      can :manage, 'admin/feedback'
      can :manage, 'admin/notes'
      can :manage, 'admin/pages'
      can :manage, 'admin/post_types'
      can :manage, 'admin/redirects'
      can :manage, 'admin/resources'
      can :manage, 'admin/tags'
    when 'contributor'
    end

    # TODO: Limit these!
    can :manage, 'admin/cache'
    can :manage, 'admin/dashboard'
    can :manage, 'admin/textfilters'
    can :manage, 'admin/profiles'
    can :manage, 'admin/migrations'

    can :manage, 'articles'
  end
end<commit_msg>Clean up abilites<commit_after>class Ability
  include CanCan::Ability

  def initialize(user)
    return unless user

    case user.profile.label
    when 'admin'
      add_admin_abilities
      add_publisher_abilities
      add_contributor_abilities
    when 'publisher'
      add_publisher_abilities
      add_contributor_abilities
    when 'contributor'
      add_contributor_abilities
    end
  end

  private

  def add_admin_abilities
    can :manage, 'admin/cache'
    can :manage, 'admin/migrations'
    can :manage, 'admin/seo'
    can :manage, 'admin/settings'
    can :manage, 'admin/sidebar'
    can :manage, 'admin/textfilters'
    can :manage, 'admin/themes'
    can :manage, 'admin/users'
  end

  def add_publisher_abilities
    can :manage, 'admin/content'
    can :manage, 'admin/feedback'
    can :manage, 'admin/notes'
    can :manage, 'admin/pages'
    can :manage, 'admin/post_types'
    can :manage, 'admin/redirects'
    can :manage, 'admin/resources'
    can :manage, 'admin/tags'

    can :manage, 'articles'
  end

  def add_contributor_abilities
    can :manage, 'admin/dashboard'
    can :manage, 'admin/profiles'
  end
end
{'fraction_non_alphanumeric': 0.11242603550295859, 'fraction_numerical': 0.0, 'mean_word_length': 2.893092105263158, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5356087', 'n_tokens_mistral': 834, 'n_tokens_neox': 765, 'n_words': 201}