Zhang Huangbin avatar Zhang Huangbin committed 5a6a8ce

Code cleanup.

Comments (0)

Files changed (3)

 }
 
 # Mail list access policies.
+# Unrestricted
 MAILLIST_POLICY_PUBLIC = 'public'
+# Only users under same domain are allowed
 MAILLIST_POLICY_DOMAIN = 'domain'
+# Only users under same domain and sub domains are allowed
 MAILLIST_POLICY_SUBDOMAIN = 'subdomain'
+# Only members are allowed
 MAILLIST_POLICY_MEMBERSONLY = 'membersonly'
+# Only moderators/allowed are allowed
 MAILLIST_POLICY_ALLOWEDONLY = 'allowedonly'
+# Only members and moderators are allowed
 MAILLIST_POLICY_MEMBERSANDMODERATORSONLY = 'membersandmoderatorsonly'
-
-# Comments of mail list access policies.
-MAILLIST_ACCESS_POLICIES = {
-    MAILLIST_POLICY_PUBLIC: 'Unrestricted',
-    MAILLIST_POLICY_DOMAIN: 'Only users under same domain are allowed',
-    MAILLIST_POLICY_SUBDOMAIN: 'Only users under same domain and sub domains are allowed',
-    MAILLIST_POLICY_MEMBERSONLY: 'Only members are allowed',
-    MAILLIST_POLICY_ALLOWEDONLY: 'Only moderators/allowed are allowed',
-    MAILLIST_POLICY_MEMBERSANDMODERATORSONLY: 'Only members and moderators are allowed',
-}

plugins/ldap_maillist_access_policy.py

 # Note: Access policy is defined in libs/__init__.py.
 
 import logging
-from libs import SMTP_ACTIONS, MAILLIST_ACCESS_POLICIES
+from libs import SMTP_ACTIONS
 from libs.ldaplib import conn_utils
 
 REQUIRE_LOCAL_SENDER = False
     policy = recipient_ldif.get('accessPolicy', ['public'])[0].lower()
 
     # Log access policy and description
-    logging.debug('%s -> %s, access policy: %s (%s)' % (
-        sender, recipient, policy,
-        MAILLIST_ACCESS_POLICIES.get(policy, 'no description'))
-    )
+    logging.debug('%s -> %s, access policy: %s' % (sender, recipient, policy))
 
     if policy in ['domain', 'subdomain', ]:
         recipient_domain = recipient.split('@', 1)[-1]

plugins/sql_alias_access_policy.py

 from libs import MAILLIST_POLICY_MEMBERSONLY
 from libs import MAILLIST_POLICY_ALLOWEDONLY
 from libs import MAILLIST_POLICY_MEMBERSANDMODERATORSONLY
-from libs import MAILLIST_ACCESS_POLICIES
 
 
 def restriction(**kwargs):
     policy = str(sql_record[0]).lower()
 
     # Log access policy and description
-    logging.debug('%s -> %s, access policy: %s (%s)' % (
-        sender, recipient, policy,
-        MAILLIST_ACCESS_POLICIES.get(policy, 'no description'))
-    )
+    logging.debug('%s -> %s, access policy: %s' % (sender, recipient, policy))
 
     members = [str(v.lower()) for v in str(sql_record[1]).split(',')]
     moderators = [str(v.lower()) for v in str(sql_record[2]).split(',')]
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.