Skip to content

Commit b5809fd

Browse files
authored
Merge pull request #172 from alphagov/rename-admin-user-to-signon-user
Rename AdminUser to SignonUser
2 parents 74a865b + ab7750a commit b5809fd

33 files changed

Lines changed: 69 additions & 62 deletions
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class Admin::BaseController < ApplicationController
22
layout "admin"
3-
before_action { authorise_user!(AdminUser::Permissions::ADMIN_AREA) }
4-
before_action { Current.admin_user = current_user }
3+
before_action { authorise_user!(SignonUser::Permissions::ADMIN_AREA) }
4+
before_action { Current.signon_user = current_user }
55
end

app/controllers/admin/early_access_users_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def delete
5353

5454
def destroy
5555
EarlyAccessUser.find(params[:id])
56-
.destroy_with_audit(deletion_type: :admin, deleted_by_admin_user_id: current_user.id)
56+
.destroy_with_audit(deletion_type: :admin, deleted_by_signon_user_id: current_user.id)
5757

5858
redirect_to admin_early_access_users_path, notice: "User deleted"
5959
end

app/controllers/admin/waiting_list_users_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def delete
5757

5858
def destroy
5959
WaitingListUser.find(params[:id])
60-
.destroy_with_audit(deletion_type: "admin", deleted_by_admin_user_id: current_user.id)
60+
.destroy_with_audit(deletion_type: "admin", deleted_by_signon_user_id: current_user.id)
6161

6262
redirect_to admin_waiting_list_users_path, notice: "User deleted"
6363
end

app/models/current.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
class Current < ActiveSupport::CurrentAttributes
2-
attribute :admin_user
2+
attribute :signon_user
33
end

app/models/early_access_user.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ def self.aggregate_export_data(until_date)
7575
hash
7676
end
7777

78-
def destroy_with_audit(deletion_type:, deleted_by_admin_user_id: nil)
78+
def destroy_with_audit(deletion_type:, deleted_by_signon_user_id: nil)
7979
transaction do
8080
destroy!
8181
DeletedEarlyAccessUser.create!(id:,
82-
deleted_by_admin_user_id:,
82+
deleted_by_signon_user_id:,
8383
deletion_type:,
8484
login_count:,
8585
user_source: source,

app/models/settings_audit.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
class SettingsAudit < ApplicationRecord
2-
belongs_to :user, optional: true, class_name: "AdminUser"
2+
belongs_to :user, optional: true, class_name: "SignonUser"
33
end
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class AdminUser < ApplicationRecord
1+
class SignonUser < ApplicationRecord
22
include GDS::SSO::User
33

44
module Permissions

app/models/waiting_list_user.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ def self.aggregate_export_data(until_date)
3535
hash
3636
end
3737

38-
def destroy_with_audit(deletion_type:, deleted_by_admin_user_id: nil)
38+
def destroy_with_audit(deletion_type:, deleted_by_signon_user_id: nil)
3939
transaction do
4040
destroy!
4141
DeletedWaitingListUser.create!(id:,
42-
deleted_by_admin_user_id:,
42+
deleted_by_signon_user_id:,
4343
deletion_type:,
4444
user_source: source,
4545
user_created_at: created_at)

app/views/admin/homepage/index.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<%
22
content_for(:title, "GOV.UK Chat Admin")
3-
has_developer_tools_permission = Current.admin_user.has_permission?(AdminUser::Permissions::DEVELOPER_TOOLS)
3+
has_developer_tools_permission = Current.signon_user.has_permission?(SignonUser::Permissions::DEVELOPER_TOOLS)
44
settings = Settings.instance
55

66
dashboard_link_items = []

app/views/layouts/admin.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
["Early access users", admin_early_access_users_path],
1515
["Waiting list users", admin_waiting_list_users_path],
1616
["Settings", admin_settings_path],
17-
[Current.admin_user.name, href: Plek.external_url_for("signon")],
17+
[Current.signon_user.name, href: Plek.external_url_for("signon")],
1818
["Log out", gds_sign_out_path],
1919
]
2020
%>

0 commit comments

Comments
 (0)