Class: ASF::Auth::MembersAndOfficers
- Inherits:
-
Rack::Auth::Basic
- Object
- Rack::Auth::Basic
- ASF::Auth::MembersAndOfficers
- Defined in:
- lib/whimsy/asf/rack.rb
Overview
‘use’ the following class in config.ru to limit access to the application to ASF members and officers and the accounting group.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ MembersAndOfficers
constructor
A new instance of MembersAndOfficers.
Constructor Details
#initialize(app) ⇒ MembersAndOfficers
Returns a new instance of MembersAndOfficers.
62 63 64 |
# File 'lib/whimsy/asf/rack.rb', line 62 def initialize(app) super(app, "ASF Members and Officers", &proc {}) end |
Instance Method Details
#call(env) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/whimsy/asf/rack.rb', line 66 def call(env) = ( ENV['RACK_ENV'] == 'test' ) person = ASF::Auth.decode(env) ||= DIRECTORS[env.user] ||= person.asf_member? ||= ASF.pmc_chairs.include? person if not accounting = ASF::Authorization.new('pit'). find {|group, list| group=='accounting'} = (accounting and accounting.last.include? env.user) end if @app.call(env) else end end |