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 invited guests to see board agenda
Date Mon, 13 Jun 2016 20:00:50 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git

The following commit(s) were added to refs/heads/master by this push:
       new  a8aa673   allow invited guests to see board agenda
a8aa673 is described below

commit a8aa673d7152514115356b6c0b89a2a7ca2fe048
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Mon Jun 13 16:00:20 2016 -0400

    allow invited guests to see board agenda
---
 lib/whimsy/asf/rack.rb     | 7 ++++---
 www/board/agenda/config.ru | 9 ++++++++-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/lib/whimsy/asf/rack.rb b/lib/whimsy/asf/rack.rb
index 60468eb..50b8cb6 100644
--- a/lib/whimsy/asf/rack.rb
+++ b/lib/whimsy/asf/rack.rb
@@ -59,18 +59,19 @@ module ASF
     # 'use' the following class in config.ru to limit access
     # to the application to ASF members and officers and the accounting group.
     class MembersAndOfficers < Rack::Auth::Basic
-      def initialize(app)
+      def initialize(app, &block)
         super(app, "ASF Members and Officers", &proc {})
+        @block = block 
       end
 
-      def call(env)
+      def call(env, &block)
         authorized = ( ENV['RACK_ENV'] == 'test' )
 
         person = ASF::Auth.decode(env)
 
-        authorized ||= DIRECTORS[env.user]
         authorized ||= person.asf_member?
         authorized ||= ASF.pmc_chairs.include? person
+        authorized ||= @block.call(env) if @block
 
         if not authorized
           accounting = ASF::Authorization.new('pit').
diff --git a/www/board/agenda/config.ru b/www/board/agenda/config.ru
index 2068724..694c5bb 100644
--- a/www/board/agenda/config.ru
+++ b/www/board/agenda/config.ru
@@ -3,7 +3,14 @@ require File.expand_path('../main.rb', __FILE__)
 require 'whimsy/asf/rack'
 
 # https://svn.apache.org/repos/infra/infrastructure/trunk/projects/whimsy/asf/rack.rb
-use ASF::Auth::MembersAndOfficers
+use ASF::Auth::MembersAndOfficers do |env|
+  # additionally authorize all invited guests
+  agenda = dir('board_agenda_*.txt').sort.last
+  Agenda.parse(agenda, :full)
+  roll = Agenda[agenda][:parsed].find {|item| item['title'] == 'Roll Call'}
+  roll['people'].keys.include? env['REMOTE_USER']
+end
+
 use ASF::HTTPS_workarounds
 
 run Sinatra::Application

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <commits@whimsical.apache.org>'].

Mime
View raw message