Commit 781d42b4e53b43e2392abd5d851b2ff2a38353a4
1 parent
dbc3b318
Exists in
staging
and in
42 other branches
ActionItem1165: changing the mail view definition
Showing
1 changed file
with
16 additions
and
6 deletions
Show diff stats
util/mail/postgresql/mail_users.sql
... | ... | @@ -2,7 +2,7 @@ CREATE OR REPLACE VIEW mail_users |
2 | 2 | AS |
3 | 3 | SELECT |
4 | 4 | users.login || '@' || domains.name as username, |
5 | - '{MD5}' || encode(decode(users.crypted_password,'hex'), 'base64') | |
5 | + users.crypted_password as crypted_password, | |
6 | 6 | as passwd, |
7 | 7 | '' as clearpasswd, |
8 | 8 | 5000 as uid, |
... | ... | @@ -20,10 +20,21 @@ JOIN profiles on |
20 | 20 | JOIN environments on |
21 | 21 | (environments.id = profiles.environment_id) |
22 | 22 | JOIN domains on |
23 | - (domains.owner_id = environments.id and | |
24 | - domains.owner_type = 'Environment') | |
23 | + ( | |
24 | + ( | |
25 | + profiles.preferred_domain is null and | |
26 | + domains.owner_id = environments.id and | |
27 | + domains.owner_type = 'Environment' | |
28 | + ) | |
29 | + OR | |
30 | + ( | |
31 | + profiles.preferred_domain_id is not null and | |
32 | + domain.owner_id = profiles.id and | |
33 | + domains.owner_type = 'Profile' | |
34 | + ) | |
35 | + ) | |
25 | 36 | WHERE |
26 | - users.password_type = 'md5' | |
37 | + users.password_type = 'crypt' | |
27 | 38 | AND domains.is_default |
28 | 39 | AND users.enable_email; |
29 | 40 | |
... | ... | @@ -47,5 +58,4 @@ JOIN domains domains_to on |
47 | 58 | domains_to.owner_type = 'Environment' and |
48 | 59 | domains_to.is_default) |
49 | 60 | WHERE |
50 | - users.password_type = 'md5' | |
51 | - AND users.enable_email; | |
61 | + users.enable_email; | ... | ... |