Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cba to logs #1975

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions app/controllers/super_admin/organisations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
class SuperAdmin::OrganisationsController < SuperAdminController
helper_method :sort_column, :sort_direction

before_action :set_organisation, only: %i[toggle_cba_feature]
before_action :set_organisation, only: %i[show destroy toggle_cba_feature]

def index
@organisations = Organisation.sortable_with_child_counts(sort_column, sort_direction)

@location_count = Location.count

respond_to do |format|
format.html
format.csv { send_data Organisation.all_as_csv, filename: "organisations.csv" }
Expand All @@ -21,14 +18,12 @@ def service_emails
end

def show
@organisation = Organisation.find(params[:id])
@team = @organisation.users.order("#{sort_column} #{sort_direction}")
@pagy, @locations = pagy(@organisation.locations.order("address asc"))
end

def destroy
organisation = Organisation.find(params[:id])
organisation.destroy!
@organisation.destroy!
UseCases::Administrator::PublishOrganisationNames.new.publish
redirect_to super_admin_organisations_path, notice: "Organisation has been removed"
end
Expand Down
9 changes: 7 additions & 2 deletions app/views/logs/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<% unless log_search_form.username %>
<th class="govuk-table__header" scope="col">Username</th>
<th class="govuk-table__header" scope="col">Username or ID</th>
<% end %>
<% if log_search_form.ip && current_organisation&.cba_enabled? %>
<th class="govuk-table__header" scope="col">Authentication Method</th>
<% end %>
<th class="govuk-table__header" scope="col">Access Point</th>
<th class="govuk-table__header" scope="col">MAC Address</th>
Expand All @@ -59,7 +62,9 @@
<% end %>
</td>
<% end %>

<% if log_search_form.ip && current_organisation&.cba_enabled? %>
<td class="govuk-table__cell"><%= log.cert_name %></td>
<% end %>
<td class="govuk-table__cell"><%= log.ap %></td>
<td class="govuk-table__cell"><%= log.mac %></td>
<% unless log_search_form.ip %>
Expand Down
5 changes: 5 additions & 0 deletions mysql/rr_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ CREATE TABLE `sessions` (
`building_identifier` varchar(20) DEFAULT NULL,
`success` tinyint(1) DEFAULT NULL,
`task_id` varchar(100) DEFAULT '',
`cert_name` varchar(100) DEFAULT NULL,
`authentication_reply` varchar(100) DEFAULT NULL,
`cert_serial` char(100) DEFAULT NULL,
`cert_issuer` varchar(100) DEFAULT NULL,
`cert_subject` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `siteIP` (`siteIP`,`username`),
KEY `sessions_username` (`username`),
Expand Down
11 changes: 8 additions & 3 deletions spec/features/logging/view_auth_requests_for_an_ip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
let(:ip) { location.ips.first.address }
let(:location) { user.organisations.first.locations.first }
before do
create(:organisation, :with_location_and_ip, users: [user])
create(:session, siteIP: ip, username: "Aaaaaa")
create(:organisation, :with_location_and_ip, users: [user], cba_enabled: true)
create(:session, siteIP: ip, username: "Aaaaaa", cert_name: "EAP-TLS")
end
describe "when using a link" do
before do
Expand All @@ -19,10 +19,15 @@
click_on "View logs"
end
end

it "displays the authentication requests" do
expect(page).to have_content("Found 1 result for IP: \"#{ip}\"")
end

context "when the organisations is using CBA" do
it "displays the certificate data" do
expect(page).to have_content("EAP-TLS")
end
end
end

context "when searching for an IP address" do
Expand Down
Loading