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 977dedd  Cross-check of private@ list for podlings
977dedd is described below

commit 977dedd8dbdb8bd7ae62daad18a727fee6246280
Author: Sebb <[email protected]>
AuthorDate: Wed Dec 12 20:51:38 2018 +0000

    Cross-check of private@ list for podlings
---
 www/roster/models/ppmc.rb           | 79 ++++++++++++++++++++++++++++++-----
 www/roster/views/ppmc/members.js.rb | 82 ++++++++++++++++++++++++++++++++++++-
 2 files changed, 148 insertions(+), 13 deletions(-)

diff --git a/www/roster/models/ppmc.rb b/www/roster/models/ppmc.rb
index adac18c..7095a03 100644
--- a/www/roster/models/ppmc.rb
+++ b/www/roster/models/ppmc.rb
@@ -9,23 +9,37 @@ class PPMC
       list =~ /^(incubator-)?#{ppmc.mail_list}\b/
     end
 
+    # separate out the known ASF members and extract any matching committer 
details
+    unknownSubs = []
+    asfMembers = []
     # Also look for non-ASF mod emails
     nonASFmails=Hash.new
 
-    user = ASF::Person.find(env.user)
-    if user.asf_member? or ppmc.members.include? user
+    moderators = nil
+    modtime = nil
+    subscribers = nil # we get the counts only here
+    subtime = nil
+    pSubs = Array.new # private@ subscribers
+    unMatchedSubs = [] # unknown private@ subscribers
+    currentUser = ASF::Person.find(env.user)
+    analysePrivateSubs = false # whether to show missing private@ subscriptions
+    if currentUser.asf_member? or ppmc.members.include? currentUser
       require 'whimsy/asf/mlist'
       moderators, modtime = ASF::MLIST.list_moderators(ppmc.mail_list, true)
       subscribers, subtime = ASF::MLIST.list_subscribers(ppmc.mail_list, true) 
# counts only
-      load_emails # set up @people
+      analysePrivateSubs = currentUser.asf_member?
+      unless analysePrivateSubs # check for private moderator if not already 
allowed access
+        user_mail = currentUser.all_mail || []
+        pMods = moderators["private@#{ppmc.mail_list}.apache.org"] || []
+        analysePrivateSubs = !(pMods & user_mail).empty?
+      end
+      if analysePrivateSubs
+        pSubs = ASF::MLIST.private_subscribers(ppmc.mail_list)[0]||[]
+        unMatchedSubs=Set.new(pSubs) # init ready to remove matched mails
+        pSubs.map!{|m| m.downcase} # for matching
+      end
+
       moderators.each { |list,mods| mods.each {|m| nonASFmails[m]='' unless 
m.end_with? '@apache.org'} }
-      nonASFmails.each {|k,v|
-        @people.each do |person|
-          if person[:mail].any? {|mail| mail.downcase == k.downcase}
-            nonASFmails[k] = person[:id]
-          end
-        end
-      }
     else
       lists = lists.select {|list, mode| mode == 'public'}
     end
@@ -36,7 +50,14 @@ class PPMC
     owners = ppmc.owners
 
     roster = ppmc.members.map {|person|
+      notSubbed = false
+      if analysePrivateSubs and owners.include? person
+        allMail = person.all_mail.map{|m| m.downcase}
+        notSubbed = (allMail & pSubs).empty?
+        unMatchedSubs.delete_if {|k| allMail.include? k.downcase}
+      end
       [person.id, {
+        notSubbed: notSubbed,
         name: person.public_name, 
         member: person.asf_member?,
         icommit: incubator_committers.include?(person),
@@ -55,10 +76,43 @@ class PPMC
         role: 'Mentor',
         githubUsername: (person.attrs['githubUsername'] || []).join(', ')
       }
+      if analysePrivateSubs
+        allMail = person.all_mail.map{|m| m.downcase}
+        roster[person.id]['notSubbed'] = (allMail & pSubs).empty?
+        unMatchedSubs.delete_if {|k| allMail.include? k.downcase}
+      end
     end
 
     statusInfo = ppmc.podlingStatus || {news: []}
 
+    if unMatchedSubs.length > 0 or nonASFmails.length > 0
+      load_emails # set up @people
+      unMatchedSubs.each{ |addr|
+        who = nil
+        @people.each do |person|
+          if person[:mail].any? {|mail| mail.downcase == addr.downcase}
+            who = person
+          end
+        end
+        if who
+          if who[:member]
+            asfMembers << { addr: addr, person: who }
+          else
+            unknownSubs << { addr: addr, person: who }
+          end
+        else
+          unknownSubs << { addr: addr, person: nil }
+        end
+      }
+      nonASFmails.each {|k,v|
+        @people.each do |person|
+          if person[:mail].any? {|mail| mail.downcase == k.downcase}
+            nonASFmails[k] = person[:id]
+          end
+        end
+      }
+    end
+
     response = {
       id: id,
       display_name: ppmc.display_name,
@@ -83,6 +137,9 @@ class PPMC
       duration: ppmc.duration,
       podlingStatus: statusInfo,
       namesearch: ppmc.namesearch,
+      analysePrivateSubs: analysePrivateSubs,
+      unknownSubs: unknownSubs,
+      asfMembers: asfMembers,
     }
 
     response
@@ -105,7 +162,7 @@ class PPMC
         result[:member] = true if person.asf_member?
         result
       }
-  
+
       # cache
       @people_time = Time.now
     end
diff --git a/www/roster/views/ppmc/members.js.rb 
b/www/roster/views/ppmc/members.js.rb
index c1ee037..f5870ab 100644
--- a/www/roster/views/ppmc/members.js.rb
+++ b/www/roster/views/ppmc/members.js.rb
@@ -24,6 +24,80 @@ class PPMCMembers < Vue
         end
       end
     end
+
+    if @@ppmc.analysePrivateSubs
+      _h4.crosscheck! 'Cross-check of private@ list subscriptions'
+      _p {
+        _ 'PPMC entries above with (*) do not appear to be subscribed to the 
private list.'
+        _br
+        _ 'This could be because the person is subscribed with an address that 
is not in their LDAP record'
+      }
+      # separate out the known ASF members and extract any matching committer 
details
+      unknownSubs = @@ppmc.unknownSubs
+      asfMembers = @@ppmc.asfMembers
+      # Any unknown subscribers?
+      if unknownSubs.length > 0
+        _p {
+          # We don't use the short-hand name: value syntax here to work-round 
Eclipse Ruby editor parsing bug
+          _span.glyphicon.glyphicon_lock aria_hidden: true, :class => 
'text-primary', 'aria-label' => 'ASF Members and private@ moderators'
+          _ 'The following subscribers to the private list do not match the 
known emails for any of the existing PPMC (or ASF) members.'
+          _br
+          _ 'They could be PPMC (or ASF) members whose emails are not listed 
in their LDAP record.'
+          _br
+          _ 'Or they could be ex-PPMC members who are still subscribed.'
+          _br 
+          _ '(Note that digest subscriptions are not currently included)'
+          _br
+          _br
+          _ul {
+            unknownSubs.each do |sub|
+              person = sub['person']
+              if person
+                _li {
+                  _ sub['addr']
+                  _ ' '
+                  _ person['name']
+                  _ ' ' 
+                  _a person['id'], href: "committer/#{person['id']}"
+                } 
+              else
+                _li {
+                  _ sub['addr']
+                  _ ' '
+                  _ '(not recognised)'
+                }
+              end
+            end
+          }
+        }
+      end
+      # Any ASF members?
+      if asfMembers.length > 0
+        _p {
+          # We don't use the short-hand name: value syntax here to work-round 
Eclipse Ruby editor parsing bug
+          _span.glyphicon.glyphicon_lock aria_hidden: true, :class => 
'text-primary', 'aria-label' => 'ASF Members and private@ moderators'
+          _ 'The following ASF members are also subscribed to the list.'
+          _br
+          _br
+          _ul {
+            asfMembers.each do |sub|
+              person = sub['person']
+              if person
+                _li {
+                  _strong {
+                    _ sub['addr']
+                    _ ' '
+                    _ person['name']
+                    _ ' ' 
+                    _a person['id'], href: "committer/#{person['id']}"
+                  }
+                } 
+              end
+            end
+          }
+        }
+      end
+    end
   end
 
   def mounted()
@@ -60,11 +134,15 @@ class PPMCMember < Vue
       end
 
       if @@person.member
-        _td { _b { _a @@person.id, href: "committer/#{@@person.id}" } }
+        _td { _b { _a @@person.id, href: "committer/#{@@person.id}" }
+              _a ' (*)', href: "ppmc/#{@@ppmc.id}#crosscheck" if 
@@person.notSubbed and @@ppmc.analysePrivateSubs
+            }
         _td @@person.githubUsername
         _td { _b @@person.name }
       else
-        _td { _a @@person.id, href: "committer/#{@@person.id}" }
+        _td { _a @@person.id, href: "committer/#{@@person.id}"
+              _a ' (*)', href: "ppmc/#{@@ppmc.id}#crosscheck" if 
@@person.notSubbed and @@ppmc.analysePrivateSubs
+            }
         _td @@person.githubUsername
         _td @@person.name
       end

Reply via email to