<commit_before># An Account on DocumentCloud can be used to access the workspace and upload
# documents. Accounts have full priviledges for the entire organization, at the
# moment.
class Account < ActiveRecord::Base
  include DC::Access

  ADMINISTRATOR = 1
  CONTRIBUTOR   = 2
  REVIEWER      = 3

  # Associations:
  belongs_to  :organization
  has_many    :projects,             :dependent => :destroy
  has_many    :annotations
  has_many    :collaborations,       :dependent => :destroy
  has_many    :processing_jobs,      :dependent => :destroy
  has_one     :security_key,         :dependent => :destroy, :as => :securable
  has_many    :shared_projects,      :through => :collaborations, :source => :project
  has_many    :document_reviewers,   :dependent => :destroy
  has_many    :reviewable_documents, :through => :document_reviewers, :source => :document

  # Validations:
  validates_presence_of   :first_name, :last_name, :email
  validates_format_of     :email, :with => DC::Validators::EMAIL
  validates_uniqueness_of :email, :case_sensitive => false

  # Delegations:
  delegate :name, :to => :organization, :prefix => true

  # Scopes:
  named_scope :admin, {:conditions => {:role => ADMINISTRATOR}}
  named_scope :contributors, {:conditions => ["role IN (?)", [ADMINISTRATOR, CONTRIBUTOR]]}

  # Attempt to log in with an email address and password.
  def self.log_in(email, password, session=nil)<commit_msg>allow_nil => true<commit_after># An Account on DocumentCloud can be used to access the workspace and upload
# documents. Accounts have full priviledges for the entire organization, at the
# moment.
class Account < ActiveRecord::Base
  include DC::Access

  ADMINISTRATOR = 1
  CONTRIBUTOR   = 2
  REVIEWER      = 3

  # Associations:
  belongs_to  :organization
  has_many    :projects,             :dependent => :destroy
  has_many    :annotations
  has_many    :collaborations,       :dependent => :destroy
  has_many    :processing_jobs,      :dependent => :destroy
  has_one     :security_key,         :dependent => :destroy, :as => :securable
  has_many    :shared_projects,      :through => :collaborations, :source => :project
  has_many    :document_reviewers,   :dependent => :destroy
  has_many    :reviewable_documents, :through => :document_reviewers, :source => :document

  # Validations:
  validates_presence_of   :first_name, :last_name, :email
  validates_format_of     :email, :with => DC::Validators::EMAIL
  validates_uniqueness_of :email, :case_sensitive => false

  # Delegations:
  delegate :name, :to => :organization, :prefix => true, :allow_nil => true

  # Scopes:
  named_scope :admin, {:conditions => {:role => ADMINISTRATOR}}
  named_scope :contributors, {:conditions => ["role IN (?)", [ADMINISTRATOR, CONTRIBUTOR]]}

  # Attempt to log in with an email address and password.
  def self.log_in(email, password, session=nil)
{'fraction_non_alphanumeric': 0.10679611650485436, 'fraction_numerical': 0.0020804438280166435, 'mean_word_length': 3.957044673539519, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, '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': '195835', 'n_tokens_mistral': 912, 'n_tokens_neox': 864, 'n_words': 248}