-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Automated] Merged master into target k8s
- Loading branch information
Showing
4 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...e/20240408152120_add_service_levels_and_credential_service_providers_to_client_configs.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class AddServiceLevelsAndCredentialServiceProvidersToClientConfigs < ActiveRecord::Migration[7.1] | ||
def change | ||
add_column :client_configs, :service_levels, :string, array: true, default: %w[ial1 ial2 loa1 loa3 min] | ||
add_column :client_configs, :credential_service_providers, :string, array: true, default: %w[logingov idme dslogon mhv] | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# frozen_string_literal: true | ||
|
||
desc 'Lock and unlock user credentials' | ||
namespace :user_credential do | ||
task :lock, %i[type credential_id requested_by] => :environment do |_, args| | ||
namespace = 'UserCredential::Lock' | ||
validate_args(args) | ||
type = args[:type] | ||
credential_id = args[:credential_id] | ||
context = { type:, credential_id:, requested_by: args[:requested_by] } | ||
log_task(namespace:, status: 'start', context:) | ||
user_verification = UserVerification.where(["#{type}_uuid = ?", credential_id]).first | ||
user_verification.lock! | ||
log_task(namespace:, status: 'complete', context: context.merge(locked: user_verification.locked)) | ||
puts "#{namespace} complete - #{type}_uuid: #{credential_id}" | ||
rescue => e | ||
puts "#{namespace} failed - #{e.message}" | ||
end | ||
|
||
task :unlock, %i[type credential_id requested_by] => :environment do |_, args| | ||
namespace = 'UserCredential::Unlock' | ||
validate_args(args) | ||
type = args[:type] | ||
credential_id = args[:credential_id] | ||
context = { type:, credential_id:, requested_by: args[:requested_by] } | ||
log_task(namespace:, status: 'start', context:) | ||
user_verification = UserVerification.where(["#{type}_uuid = ?", credential_id]).first | ||
user_verification.unlock! | ||
log_task(namespace:, status: 'complete', context: context.merge(locked: user_verification.locked)) | ||
puts "#{namespace} complete - #{type}_uuid: #{credential_id}" | ||
rescue => e | ||
puts "#{namespace} failed - #{e.message}" | ||
end | ||
|
||
def validate_args(args) | ||
raise 'Missing required arguments' if args[:type].blank? || | ||
args[:credential_id].blank? || | ||
args[:requested_by].blank? | ||
end | ||
|
||
def log_task(namespace:, status:, context:) | ||
Rails.logger.info("[#{namespace}] rake task #{status}", context) | ||
end | ||
end |