<commit_before># frozen_string_literal: true

class CourseGroupPolicy < ApplicationPolicy
  class Scope < ApplicationPolicy::Scope
    def post_initialize
    end

    def authorized_to_edit_records
      scope.delegated_to(user)
    end

    def authorized_to_view_records
      scope.visible_or_delegated_to(user)
    end
  end

  attr_reader :course_group

  def post_initialize(course_group)
    @course_group = course_group
  end

  def new?
    course_group.organization && user.authorized_to_edit?(course_group.organization)
  end

  def create?
    course_group.organization && user.authorized_to_edit?(course_group.organization)
  end
end<commit_msg>Relax course group policy<commit_after># frozen_string_literal: true

class CourseGroupPolicy < ApplicationPolicy
  class Scope < ApplicationPolicy::Scope
    def post_initialize
    end

    def authorized_to_edit_records
      scope.delegated_to(user)
    end

    def authorized_to_view_records
      scope.visible_or_delegated_to(user)
    end
  end

  attr_reader :course_group

  def post_initialize(course_group)
    @course_group = course_group
  end

  def new?
    course_group.organization && user.authorized_to_edit?(course_group.organization)
  end

  def create?
    new?
  end

  def edit?
    new?
  end

  def update?
    new?
  end

  def destroy?
    new?
  end
end
{'fraction_non_alphanumeric': 0.05584512285927029, 'fraction_numerical': 0.0, 'mean_word_length': 3.699300699300699, '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': '3379886', 'n_tokens_mistral': 432, 'n_tokens_neox': 417, 'n_words': 91}