<commit_before>CREATE OR REPLACE VIEW mail_users
AS
SELECT
  users.login || '@' || domains.name                      as username,
  '{MD5}' || encode(decode(users.crypted_password,'hex'), 'base64')
                                                          as passwd,
  ''                                                      as clearpasswd,
  5000                                                    as uid,
  5000                                                    as gid,
  '/home/vmail/' || domains.name                          as home,
  users.login                                             as maildir,
  NULL                                                    as quota,
  profiles.name                                           as fullname,
  ''                                                      as options,
  users.crypted_password                                  as pam_passwd
from users
JOIN profiles on
  (profiles.user_id = users.id and
   profiles.type = 'Person')
JOIN environments on
  (environments.id = profiles.environment_id)
JOIN domains on
  (domains.owner_id = environments.id and
   domains.owner_type = 'Environment')
WHERE
  users.password_type = '<PASSWORD>'
  AND domains.is_default
  AND users.enable_email;

CREATE OR REPLACE VIEW mail_aliases
AS
SELECT
  users.login || '@' || domains_from.name as source,
  users.login || '@' || domains_to.name as destination
from users
JOIN profiles on
  (profiles.user_id = users.id and
   profiles.type = 'Person')
JOIN environments on
  (environments.id = profiles.environment_id)
JOIN domains domains_from on
  (domains_from.owner_id = environments.id and
   domains_from.owner_type = 'Environment' and
   not domains_from.is_default)
JOIN domains domains_to on
  (domains_to.owner_id = environments.id and
   domains_to.owner_type = 'Environment' and
   domains_to.is_default)
WHERE
  users.password_type = '<PASSWORD>'
  AND users.enable_email;<commit_msg>ActionItem1165: changing the mail view definition<commit_after>CREATE OR REPLACE VIEW mail_users
AS
SELECT
  users.login || '@' || domains.name                      as username,
  users.crypted_password                                  as crypted_password,
                                                          as passwd,
  ''                                                      as clearpasswd,
  5000                                                    as uid,
  5000                                                    as gid,
  '/home/vmail/' || domains.name                          as home,
  users.login                                             as maildir,
  NULL                                                    as quota,
  profiles.name                                           as fullname,
  ''                                                      as options,
  users.crypted_password                                  as pam_passwd
from users
JOIN profiles on
  (profiles.user_id = users.id and
   profiles.type = 'Person')
JOIN environments on
  (environments.id = profiles.environment_id)
JOIN domains on
  (
    (
      profiles.preferred_domain is null and
      domains.owner_id = environments.id and
      domains.owner_type = 'Environment'
    )
    OR
    (
      profiles.preferred_domain_id is not null and
      domain.owner_id = profiles.id and
      domains.owner_type = 'Profile'
    )
  )
WHERE
  users.password_type = '<PASSWORD>'
  AND domains.is_default
  AND users.enable_email;

CREATE OR REPLACE VIEW mail_aliases
AS
SELECT
  users.login || '@' || domains_from.name as source,
  users.login || '@' || domains_to.name as destination
from users
JOIN profiles on
  (profiles.user_id = users.id and
   profiles.type = 'Person')
JOIN environments on
  (environments.id = profiles.environment_id)
JOIN domains domains_from on
  (domains_from.owner_id = environments.id and
   domains_from.owner_type = 'Environment' and
   not domains_from.is_default)
JOIN domains domains_to on
  (domains_to.owner_id = environments.id and
   domains_to.owner_type = 'Environment' and
   domains_to.is_default)
WHERE
  users.enable_email;
{'fraction_non_alphanumeric': 0.0702054794520548, 'fraction_numerical': 0.005626223091976516, 'mean_word_length': 1.533457249070632, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 35, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5537138', 'n_tokens_mistral': 1044, 'n_tokens_neox': 1020, 'n_words': 276}