Advertisement
Guest User

Untitled

a guest
Dec 19th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.83 KB | None | 0 0
  1. diff -r 805c15aa298a libs/ldaplib/domain.py
  2. --- a/libs/ldaplib/domain.py    Wed Dec 19 12:10:39 2018 +0800
  3. +++ b/libs/ldaplib/domain.py    Wed Dec 19 22:46:13 2018 +0800
  4. @@ -1321,50 +1321,37 @@
  5.  
  6.      elif profile_type == 'bcc':
  7.          # Enable/Disable recipient bcc.
  8. -        if 'recipientbcc' in form:
  9. -            mod_type = 'add'
  10. -        else:
  11. -            mod_type = 'delete'
  12. -
  13. -        result = ldap_lib_general.add_or_remove_attr_values(dn=domaindn,
  14. -                                                            attr='enabledService',
  15. -                                                            values=['recipientbcc'],
  16. -                                                            action=mod_type,
  17. -                                                            conn=conn)
  18. -        if result[0] is False:
  19. -            return result
  20. -
  21. -        # Update recipient bcc address.
  22. -        rcpt_bcc = form_utils.get_single_value(form,
  23. -                                               input_name='recipientBccAddress',
  24. -                                               default_value=None,
  25. -                                               is_email=True,
  26. -                                               to_string=True)
  27. -        mod_attrs += ldaputils.get_mod_replace(attr='domainRecipientBccAddress',
  28. -                                               value=rcpt_bcc)
  29. -
  30. -        # Enable/Disable sender bcc.
  31. -        if 'senderbcc' in form:
  32. -            mod_type = 'add'
  33. -        else:
  34. -            mod_type = 'delete'
  35. -
  36. -        result = ldap_lib_general.add_or_remove_attr_values(dn=domaindn,
  37. -                                                            attr='enabledService',
  38. -                                                            values=['senderbcc'],
  39. -                                                            action=mod_type,
  40. -                                                            conn=conn)
  41. -        if result[0] is False:
  42. -            return result
  43. -
  44. -        # Update sender bcc address.
  45. -        sender_bcc = form_utils.get_single_value(form,
  46. -                                                 input_name='senderBccAddress',
  47. -                                                 default_value=None,
  48. -                                                 is_email=True,
  49. -                                                 to_string=True)
  50. -        mod_attrs += ldaputils.get_mod_replace(attr='domainSenderBccAddress',
  51. -                                               value=sender_bcc)
  52. +        # form input name is same as ldap attribute value.
  53. +        for _input_name in ['recipientbcc', 'senderbcc']:
  54. +            if _input_name in form:
  55. +                mod_type = 'add'
  56. +            else:
  57. +                mod_type = 'delete'
  58. +
  59. +            _qr = ldap_lib_general.add_or_remove_attr_values(dn=domaindn,
  60. +                                                             attr='enabledService',
  61. +                                                             values=[_input_name],
  62. +                                                             action=mod_type,
  63. +                                                             conn=conn)
  64. +
  65. +            if not _qr[0]:
  66. +                return result
  67. +
  68. +        # Update sender/recipient bcc address.
  69. +        for (_input_name, _attr) in [('senderBccAddress', 'domainSenderBccAddress'),
  70. +                                     ('recipientBccAddress', 'domainRecipientBccAddress')]:
  71. +            _bcc_addr = form_utils.get_single_value(form,
  72. +                                                    input_name=_input_name,
  73. +                                                    default_value='',
  74. +                                                    is_email=True,
  75. +                                                    to_string=True)
  76. +
  77. +            if _bcc_addr:
  78. +                mod_attrs += ldaputils.get_mod_replace(attr=_attr,
  79. +                                                       value=_bcc_addr)
  80. +            else:
  81. +                mod_attrs += ldaputils.get_mod_replace(attr=_attr,
  82. +                                                       value=None)
  83.  
  84.      elif profile_type == 'relay':
  85.          # transport
  86. diff -r 805c15aa298a templates/default/macros/general.html
  87. --- a/templates/default/macros/general.html Wed Dec 19 12:10:39 2018 +0800
  88. +++ b/templates/default/macros/general.html Wed Dec 19 22:46:13 2018 +0800
  89. @@ -1550,7 +1550,7 @@
  90.  {%- endmacro %}
  91.  
  92.  {% macro display_recipient_bcc(address='', label='', input_name='recipientBccAddress') -%}
  93. -    {% if address is sameas none %}
  94. +    {% if not address %}
  95.          {% set address = '' %}
  96.      {% endif %}
  97.  
  98. @@ -1566,7 +1566,7 @@
  99.  {%- endmacro %}
  100.  
  101.  {% macro display_sender_bcc(address='', label='', input_name='senderBccAddress') -%}
  102. -    {% if address is sameas none %}
  103. +    {% if not address %}
  104.          {% set address = '' %}
  105.      {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement