whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] branch master updated: filter historical comments to only include the list of projects which the user is a member of the PMC for non-ASF-members and non-officers.
Date Fri, 02 Aug 2019 14:18:47 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys 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 174d4e2  filter historical comments to only include the list of projects which the
user is a member of the PMC for non-ASF-members and non-officers.
174d4e2 is described below

commit 174d4e256d8222c26d6685cfdce97c4fa3c82af4
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Fri Aug 2 10:17:33 2019 -0400

    filter historical comments to only include the list of projects which
    the user is a member of the PMC for non-ASF-members and non-officers.
    
    will be used by reporter.apache.org
---
 www/board/agenda/config.ru |  5 +++++
 www/board/agenda/routes.rb | 14 ++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/www/board/agenda/config.ru b/www/board/agenda/config.ru
index f5edae2..4743e2c 100644
--- a/www/board/agenda/config.ru
+++ b/www/board/agenda/config.ru
@@ -15,6 +15,11 @@ use ASF::Auth::MembersAndOfficers do |env|
     next true
   end
 
+  # allow access to historical-comments for reporter tool.
+  # note: this list is filtered by routes.rb to only include the list of
+  # PMCs that the user is a member of for non-ASF-members and non-officers.
+  next true if env['PATH_INFO'] == '/json/historical-comments'
+
   # additionally authorize all invited guests
   agenda = dir('board_agenda_*.txt').sort.last
   if agenda
diff --git a/www/board/agenda/routes.rb b/www/board/agenda/routes.rb
index a5e7aba..7e7c71c 100755
--- a/www/board/agenda/routes.rb
+++ b/www/board/agenda/routes.rb
@@ -423,9 +423,19 @@ get %r{/json/chat/(\d\d\d\d_\d\d_\d\d)} do |date|
   end
 end
 
-# historical comments
+# historical comments, filtered to only include the list of projects which
+# the user is a member of the PMC for non-ASF-members and non-officers.
 get '/json/historical-comments' do
-  _json HistoricalComments.comments
+  user=ASF::Person.find(env.user)
+  comments = HistoricalComments.comments
+
+  unless user.asf_member? or ASF.pmc_chairs.include? user
+    comments = comments.select do |project, list|
+      ASF::Committee.find(project).owners.include? user
+    end
+  end
+
+  _json comments.to_h
 end
 
 # draft minutes


Mime
View raw message