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: allow latest.json to return a subset of reports for non officers
Date Thu, 08 Aug 2019 14:52:40 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 b105437  allow latest.json to return a subset of reports for non officers
b105437 is described below

commit b1054374a9cbc8f55abfcd53d8689dbc86c9c165
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Thu Aug 8 10:52:06 2019 -0400

    allow latest.json to return a subset of reports for non officers
---
 www/board/agenda/config.ru |  1 +
 www/board/agenda/routes.rb | 16 +++++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/www/board/agenda/config.ru b/www/board/agenda/config.ru
index 4d15826..907d89d 100644
--- a/www/board/agenda/config.ru
+++ b/www/board/agenda/config.ru
@@ -23,6 +23,7 @@ use ASF::Auth::MembersAndOfficers do |env|
   #   report is being posted.
   next true if env['PATH_INFO'] == '/json/historical-comments'
   next true if env['PATH_INFO'] == '/json/post'
+  next true if env['PATH_INFO'] == '/latest.json'
 
   # additionally authorize all invited guests
   agenda = dir('board_agenda_*.txt').sort.last
diff --git a/www/board/agenda/routes.rb b/www/board/agenda/routes.rb
index d561bf4..987c3fc 100755
--- a/www/board/agenda/routes.rb
+++ b/www/board/agenda/routes.rb
@@ -22,7 +22,7 @@ end
 get '/latest.json' do
   agenda = dir('board_agenda_*.txt').sort.last
   pass unless agenda
-  call env.merge(
+  call env.merge!(
     'PATH_INFO' => "/#{agenda[/\d+_\d+_\d+/].gsub('_', '-')}.json"
   )
 end
@@ -348,7 +348,16 @@ get %r{/(\d\d\d\d-\d\d-\d\d).json} do |date|
         end
       end
 
-      Agenda[file][:parsed]
+      agenda = Agenda[file][:parsed]
+
+      # filter list for non-PMC chairs and non-officers
+      user = env.respond_to?(:user) && ASF::Person.find(env.user)
+      unless !user or user.asf_member? or ASF.pmc_chairs.include? user
+        committees = user.committees.map(&:display_name)
+        agenda = agenda.select {|item| committees.include? item['title']}
+      end
+
+      agenda
     end
   ensure
     Agenda[file][:etag] = headers['ETag']
@@ -439,8 +448,9 @@ get '/json/historical-comments' do
   comments = HistoricalComments.comments
 
   unless !user or user.asf_member? or ASF.pmc_chairs.include? user
+    committees = user.committees.map(&:display_name)
     comments = comments.select do |project, list|
-      ASF::Committee.find(project).owners.include? user
+      committees.include? project
     end
   end
 


Mime
View raw message