You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2021/08/25 16:16:25 UTC

[whimsy] branch master updated: Prepare to implement auto update of moderators

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new a43db3e  Prepare to implement auto update of moderators
a43db3e is described below

commit a43db3ef3d97f97a9b868d1f08cde8ce51ca93d9
Author: Sebb <se...@apache.org>
AuthorDate: Wed Aug 25 17:16:18 2021 +0100

    Prepare to implement auto update of moderators
---
 lib/whimsy/asf/mail.rb | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/lib/whimsy/asf/mail.rb b/lib/whimsy/asf/mail.rb
index dccba3e..17ddd7e 100644
--- a/lib/whimsy/asf/mail.rb
+++ b/lib/whimsy/asf/mail.rb
@@ -138,6 +138,28 @@ module ASF
       allowed
     end
 
+    # which lists are available for automatic moderation via Whimsy?
+    # Params:
+    # ldap_pmcs: list of (P)PMC mail_list names to which the user belongs (as owner)
+    # lid_only: return lid instead of [dom,list,lid]
+    # Return: an array of entries: lid or [dom,list,lid]
+    def self.canmod(ldap_pmcs, lidonly = true)
+      allowed = []
+      parse_flags do |dom, list, _|
+        lid = archivelistid(dom, list)
+        next if self.cannot_sub.include? lid # probably unnecessary
+
+        if ldap_pmcs.include? dom.sub('.apache.org', '')
+          if lidonly
+            allowed << lid
+          else
+            allowed << [dom, list, lid]
+          end
+        end
+      end
+      allowed
+    end
+
     # common configuration for sending mail; loads <tt>:sendmail</tt>
     # configuration from <tt>~/.whimsy</tt> if available; otherwise default
     # to disable openssl verification as that is what it required in order