File tree Expand file tree Collapse file tree 7 files changed +52
-5
lines changed
Expand file tree Collapse file tree 7 files changed +52
-5
lines changed Original file line number Diff line number Diff line change 11class Admin ::StatsController < AdminController
2- disallow_account_scope
3-
42 layout "public"
53
64 def show
Original file line number Diff line number Diff line change 11class AdminController < ApplicationController
2+ disallow_account_scope
23 before_action :ensure_staff
34end
Original file line number Diff line number Diff line change @@ -24,5 +24,7 @@ class Application < Rails::Application
2424 config . generators do |g |
2525 g . orm :active_record , primary_key_type : :uuid
2626 end
27+
28+ config . mission_control . jobs . http_basic_auth_enabled = false
2729 end
2830end
Original file line number Diff line number Diff line change 11Rails . application . config . before_initialize do
2- # We don't want normal tenanted authentication on mission control.
3- # Note that we're using HTTP basic auth configured via credentials.
4- MissionControl ::Jobs . base_controller_class = "ActionController::Base"
2+ MissionControl ::Jobs . base_controller_class = "AdminController"
53end
Original file line number Diff line number Diff line change 1+ require "test_helper"
2+
3+ class Admin ::MissionControlTest < ActionDispatch ::IntegrationTest
4+ test "staff can access mission control jobs" do
5+ sign_in_as :david
6+
7+ untenanted do
8+ get "/admin/jobs"
9+ end
10+
11+ assert_response :success
12+ end
13+
14+ test "non-staff cannot access mission control jobs" do
15+ sign_in_as :jz
16+
17+ untenanted do
18+ get "/admin/jobs"
19+ end
20+
21+ assert_response :forbidden
22+ end
23+ end
Original file line number Diff line number Diff line change 1+ require "test_helper"
2+
3+ class Admin ::StatsControllerTest < ActionDispatch ::IntegrationTest
4+ test "staff can access stats" do
5+ sign_in_as :david
6+
7+ untenanted do
8+ get admin_stats_url
9+ end
10+
11+ assert_response :success
12+ end
13+
14+ test "non-staff cannot access stats" do
15+ sign_in_as :jz
16+
17+ untenanted do
18+ get admin_stats_url
19+ end
20+
21+ assert_response :forbidden
22+ end
23+ end
Original file line number Diff line number Diff line change 11david :
22 email_address : david@37signals.com
3+ staff : true
34
45jz :
56 email_address : jz@37signals.com
67
78kevin :
89 email_address : kevin@37signals.com
10+ staff : true
911
1012mike :
1113 email_address : mike@37signals.com
You can’t perform that action at this time.
0 commit comments