Class: GithubAuthentication::CoverbandReportersWeb
- Inherits:
-
Object
- Object
- GithubAuthentication::CoverbandReportersWeb
- Defined in:
- lib/github_authentication/coverband_reporters_web.rb
Instance Method Summary collapse
- #github_organization_authenticate!(user, organization, team) ⇒ Object private
- #matches?(request) ⇒ Boolean
Instance Method Details
permalink #github_organization_authenticate!(user, organization, team) ⇒ Object (private)
[View source] [View on GitHub]
26 27 28 29 |
# File 'lib/github_authentication/coverband_reporters_web.rb', line 26 def github_organization_authenticate!(user, organization, team) user.organization_member?(organization) && user.team_member?(team) end |
permalink #matches?(request) ⇒ Boolean
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/github_authentication/coverband_reporters_web.rb', line 5 def matches?(request) return true if Rails.env.development? warden = request.env['warden'] request.session[:coverband_user] ||= warden.user if request.session[:coverband_user].blank? warden.authenticate!(scope: :coverband) request.session[:coverband_user] = warden.user end if github_organization_authenticate!(request.session[:coverband_user], Settings.coverband.github_organization, Settings.coverband.github_team) return true end false end |