Zhang Huangbin avatar Zhang Huangbin committed 0bfab3a

Add 'moderatorsonly' in plugin: ldap_maillist_access_policy.

Comments (0)

Files changed (1)


         # Filter used to get domain members.
         searchFilter = "(&(|(objectclass=mailUser)(objectClass=mailExternalUser))(accountStatus=active)(memberOfGroup=%s))" % (recipient, )
         searchAttr = ['mail']
-    elif policy == 'allowedonly':
+    elif policy == 'allowedonly' or policy == 'moderatorsonly':
         basedn = listDn
         searchScope = 0     # Use SCOPE_BASE to improve performance.
         # Filter used to get domain moderators.
 def restriction(ldapConn, ldapBaseDn, ldapRecipientDn, ldapRecipientLdif, smtpSessionData, **kargs):
     # Return if recipient is not a mail list object.
-    if 'maillist' not in [ v.lower() for v in ldapRecipientLdif['objectClass']]:
+    if 'maillist' not in [v.lower() for v in ldapRecipientLdif['objectClass']]:
         return 'DUNNO'
     sender = smtpSessionData['sender'].lower()
     recipient = smtpSessionData['recipient'].lower()
     policy = ldapRecipientLdif.get('accessPolicy', ['public'])[0].lower()
-    if policy == "public": return 'DUNNO'   # No restriction.
+    if policy == "public":
+        # No restriction.
+        return 'DUNNO'
     elif policy == "domain":
         # Bypass all users under the same domain.
         if sender.split('@')[1] == recipient.split('@')[1]: return 'DUNNO'
-        if sender.lower() in [ v.lower() for v in allowedSenders ]:
+        if sender.lower() in [v.lower() for v in allowedSenders]:
             return 'DUNNO'
             return ACTION_REJECT
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.