<commit_before>require 'active_record'
require_relative './user'

class Carto::Permission < ActiveRecord::Base
  DEFAULT_ACL_VALUE = []

  ACCESS_READONLY   = 'r'
  ACCESS_READWRITE  = 'rw'
  ACCESS_NONE       = 'n'
  SORTED_ACCESSES = [ ACCESS_READWRITE, ACCESS_READONLY, ACCESS_NONE ]

  TYPE_USER         = 'user'
  TYPE_ORGANIZATION = 'org'
  TYPE_GROUP = 'group'

  ENTITY_TYPE_VISUALIZATION = 'vis'

  belongs_to :owner, class_name: User, select: Carto::User::SELECT_WITH_DATABASE
  belongs_to :entity, class_name: proc { self.entity_class }

  def entity_class
    case self.entity_type
    when ENTITY_TYPE_VISUALIZATION
       Carto::Visualization<commit_msg>Fix indent (once again)<commit_after>require 'active_record'
require_relative './user'

class Carto::Permission < ActiveRecord::Base
  DEFAULT_ACL_VALUE = []

  ACCESS_READONLY   = 'r'
  ACCESS_READWRITE  = 'rw'
  ACCESS_NONE       = 'n'
  SORTED_ACCESSES = [ ACCESS_READWRITE, ACCESS_READONLY, ACCESS_NONE ]

  TYPE_USER         = 'user'
  TYPE_ORGANIZATION = 'org'
  TYPE_GROUP = 'group'

  ENTITY_TYPE_VISUALIZATION = 'vis'

  belongs_to :owner, class_name: User, select: Carto::User::SELECT_WITH_DATABASE
  belongs_to :entity, class_name: proc { self.entity_class }

  def entity_class
    case self.entity_type
    when ENTITY_TYPE_VISUALIZATION
      Carto::Visualization
{'fraction_non_alphanumeric': 0.09219330855018587, 'fraction_numerical': 0.0, 'mean_word_length': 4.362549800796812, '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': '3842059', 'n_tokens_mistral': 488, 'n_tokens_neox': 468, 'n_words': 90}