Skip to content

Commit

Permalink
Add assessors and judges to the logs for user type
Browse files Browse the repository at this point in the history
Also update papertrail.
  • Loading branch information
matthewford committed Aug 15, 2024
1 parent 0e05389 commit 06625ce
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,16 @@ def set_context_tags

private

# Used for ASIM Logging
def set_current_attributes
Current.user_id = current_user&.id || current_admin&.id
Current.user_type = if current_user.present?
"User"
elsif current_admin.present?
"Admin"
else
"Other"
end
Current.user_type = if current_user.present? || current_judge.present? || current_assessor.present?
"User"

Check failure on line 173 in app/controllers/application_controller.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/IndentationWidth: Use 2 (not 22) spaces for indentation.
elsif current_admin.present?

Check failure on line 174 in app/controllers/application_controller.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/ElseAlignment: Align `elsif` with `Current.user_type`.
"Admin"
else

Check failure on line 176 in app/controllers/application_controller.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/ElseAlignment: Align `else` with `Current.user_type`.
"Other"
end

Check failure on line 178 in app/controllers/application_controller.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/EndAlignment: `end` at 178, 24 is not aligned with `Current.user_type = if` at 172, 4.
end

def configure_permitted_parameters
Expand Down Expand Up @@ -257,9 +258,17 @@ def load_award_year_and_settings

def user_for_paper_trail
if current_admin.present? && current_admin.superadmin?
"SUPERADMIN:#{current_admin.id}"
elsif current_admin.present?
"ADMIN:#{current_admin.id}"
elsif current_assessor.present?
"ASSESSOR:#{current_assessor.id}"
elsif current_judge.present?
"JUDGE:#{current_judge.id}"
elsif current_user.present?
"USER:#{current_user.id}"
else
"UNKNOWN"
end
end

Expand Down

0 comments on commit 06625ce

Please sign in to comment.