whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: Extend checks; allow checking givenName only
Date Sat, 28 Jul 2018 15:56:48 GMT
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 507b2dc  Extend checks; allow checking givenName only
507b2dc is described below

commit 507b2dc27198a5fdc65305d7953c7c7b4b8735af
Author: Sebb <sebb@apache.org>
AuthorDate: Sat Jul 28 16:56:47 2018 +0100

    Extend checks; allow checking givenName only
---
 www/index.html               |  1 +
 www/secretary/ldap-names.cgi | 73 +++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 69 insertions(+), 5 deletions(-)

diff --git a/www/index.html b/www/index.html
index 4f114e4..e2d7e14 100644
--- a/www/index.html
+++ b/www/index.html
@@ -185,6 +185,7 @@
                 <li><a href="secretary/memapp_check">Check members.txt against
members_apps</a></li>
                 <li><a href="secretary/public-names">Public names: LDAP vs icla.txt</a></li>
                 <li><a href="secretary/ldap-names">LDAP name check: compare cn,
sn, givenName</a></li>
+                <li><a href="secretary/ldap-names?skipSN">LDAP name check: compare
cn, sn, givenName (only check givenName)</a></li>
                 <li><a href="secretary/response-time">Response time test</a></li>
               </ul>
             </div>
diff --git a/www/secretary/ldap-names.cgi b/www/secretary/ldap-names.cgi
index 8a51d95..9855e8c 100755
--- a/www/secretary/ldap-names.cgi
+++ b/www/secretary/ldap-names.cgi
@@ -30,35 +30,76 @@ _html do
     _ 'The table below show the differences, if any'
   end
 
+  skipSN = ARGV.shift == 'skipSN' # skip entries with only bad SN
+
   # prefetch LDAP data
-  people = ASF::Person.preload(%w(uid cn sn givenName))
+  people = ASF::Person.preload(%w(uid cn sn givenName loginShell))
   matches = 0
   badGiven = 0
+  badSN = 0
+
+  # prefetch ICLA data
+  ASF::ICLA.preload
 
   _table do
     _tr do
       _th 'uid'
+      _th "ICLA file"
+      _th "iclas.txt real name"
+      _th "iclas.txt public name"
       _th 'cn'
       _th 'givenName'
+      _th 'Modify?'
       _th 'sn'
+      _th 'Modify?'
     end
 
     people.sort_by(&:name).each do |p|
+      next if p.banned?
       given = p.givenName rescue '---' # some entries have not set this up
+
       givenOK = p.cn.include? given
       badGiven += 1 unless givenOK
+
       snOK = p.cn.include? p.sn
-      if givenOK and snOK
+      badSN += 1 unless snOK
+
+      if givenOK and snOK # all checks OK
         matches += 1
         next
       end
+      next if givenOK and skipSN
+
+      new_given = '???'
+      new_sn = '???'
+      names = p.cn.split(' ')
+      if names.size == 2
+        new_given = names[0]
+        new_sn = names[1]
+      elsif names.size == 4
+        if names[1..2] == %w(de la)
+          new_given = names.shift
+          new_sn = names.join(' ')
+        end
+      end
+      icla = ASF::ICLA.find_by_id(p.uid)
+      claRef = icla.claRef if icla
+      claRef ||= 'unknown'
       _tr do
         _td do
-          _a p.uid, href: '/roster/committee/' + p.uid
+          _a p.uid, href: '/roster/committer/' + p.uid
         end
         _td do
-          _ p.cn
+          file = ASF::ICLAFiles.match_claRef(claRef.untaint)
+          if file
+            _a claRef, href: "https://svn.apache.org/repos/private/documents/iclas/#{file}"
+          else
+            _ claRef
+          end
         end
+        _td (icla.legal_name rescue '?')
+        _td (icla.name rescue '?')
+        _td p.cn
         _td do
           if givenOK
             _ given
@@ -67,17 +108,39 @@ _html do
           end
         end
         _td do
+          if givenOK
+            _ ''
+          else
+              if given == p.uid or given == '---'
+                _ new_given # likely to be correct
+              else
+                _em new_given # less likely
+              end
+          end
+        end
+        _td do
           if snOK
             _ p.sn
           else
             _em p.sn
           end
         end
+        _td do
+          if snOK
+            _ ''
+          else
+            if p.sn == p.uid
+              _ new_sn
+            else
+              _em new_sn
+            end
+          end
+        end
       end
     end
   end
 
   _p do
-    _ "Total: #{people.size} Matches: #{matches} GivenBad: #{badGiven}"
+    _ "Total: #{people.size} Matches: #{matches} GivenBad: #{badGiven} SNBad: #{badSN}"
   end
 end
\ No newline at end of file


Mime
View raw message