<commit_before>class Ability
  include CanCan::Ability

  def initialize(user)
    return unless user

    allowed_controllers = AccessControl.allowed_controllers(user.profile.label, user.profile.modules)
    allowed_controllers.each do |controller_name|
      can :manage, controller_name
    end

    can :manage, "admin/cache"
    can :manage, "admin/dashboard"<commit_msg>Hard code accessible controllers the CanCanCan way<commit_after>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"
{'fraction_non_alphanumeric': 0.11418918918918919, 'fraction_numerical': 0.0, 'mean_word_length': 2.9919137466307277, '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': '1265906', 'n_tokens_mistral': 495, 'n_tokens_neox': 457, 'n_words': 123}