web47core 3.0.4 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2aa375c6bafd6b9e61b9944bbb5720b5d2653ce2a1f62b393c94cd0e77e8750a
4
- data.tar.gz: 2d99bb9412b0238e93af0605437648c7e274112f8a310c61e46c4d6f4fb87217
3
+ metadata.gz: e480097cdfea5056f5b2a510cbfe10ff47e27166751a1dfb269c60f2ac6dee32
4
+ data.tar.gz: 43ef160463a3b082c7840d9f6dc003d2acff45cf981d6c8caa7a9fdf0a5392d6
5
5
  SHA512:
6
- metadata.gz: 2196b166a60920eeb4059a465a5c7c1d95cfe57752b5dbe454c0c703417aa63dff8e0a1ee6e7c773bfe8c7b3233f4dc6ddbda1b9a68c057035cf549ed8ad21bd
7
- data.tar.gz: 99b4df58e4996d70c3fe399d3892824cfaaf3d3380f20338f753bc2e80453480db6fecae99bdec2782bab128f0b26c2694a5c2660602ad84f9963321a61d03b0
6
+ metadata.gz: 4a13cce11223eb01510f2a98ba33c66c71ee0850e57bc6476e130dc5c2ceb1a98be8d09174e30ae93521aff9a029f14c57a2a3422779d30b4be2649c473918bf
7
+ data.tar.gz: 95d123e80b3ed0ef34d6573a572c8a896ae8bee252f60a6809bc1ac83fd8ca45b15e0be51e21207b0b837ad1bfb2947d72c4bbd04bf77bd8b77d3344a10e0299
data/README.md CHANGED
@@ -10,22 +10,22 @@ Core components used commonly among all web apps for both App47 and RedMonocle
10
10
 
11
11
  ## Requirements
12
12
 
13
- * Ruby 2.7.0
13
+ * Ruby 3.0.2
14
14
 
15
15
  ### Working with Bundler and RBENV
16
16
 
17
17
  This project manages [RBENV](https://github.com/rbenv/rbenv) and manages dependencies via [Bundler](http://gembundler.com/).
18
18
 
19
19
  You must first [install RBENV](https://github.com/rbenv/rbenv#installation).
20
- Then install Ruby 2.7.0 via RBENV
20
+ Then install Ruby 3.0.2 via RBENV
21
21
  ``` shell script
22
- rbenv install 2.7.0
22
+ rbenv install 3.0.2
23
23
  ```
24
24
  You'll now notice that this project (as well as other App47 ones) contains a .ruby-version file, which is executed upon opening the project's root directory in a terminal (and IDE's like RubyMine). The .ruby-version file simply states `2.7.0` which tells RBENV to ensure the Ruby version to use for this project is 2.7.0.
25
25
 
26
- Please note, your Ruby `2.7.0` version might need bundler installed:
26
+ Please note, your Ruby `3.0.2` version might need bundler installed:
27
27
  ``` shell script
28
- gem install bundler -v 2.1.4
28
+ gem install bundler -v 2.5.4
29
29
  ```
30
30
 
31
31
  To set up this project's dependencies, which are defined in the file, `Gemfile`, you should first run
@@ -188,7 +188,9 @@ The following routes should be added to the correct namespace for your applicait
188
188
  #
189
189
  # System configuration
190
190
  #
191
- resource :system_configurations, only: %i[edit update show]
191
+ resource :system_configurations, only: %i[edit update show] do
192
+ get :sync
193
+ end
192
194
  #
193
195
  # Delayed jobs
194
196
  #
@@ -7,6 +7,7 @@
7
7
  .card-title=SystemConfiguration.environment.titleize
8
8
  .card-tray
9
9
  = edit_link_tag(SystemConfiguration, class_action_path(:edit))
10
+ = replay_link_tag(SystemConfiguration, class_action_path(:sync))
10
11
  .card
11
12
  .card-content.section-data-tables
12
13
  %table.highlight.striped.data-table
@@ -15,7 +16,7 @@
15
16
  =table_header_tag :field
16
17
  =table_header_tag :value
17
18
  %tbody
18
- - SystemConfiguration.allowed_param_names.each do |field|
19
+ - SystemConfiguration.allowed_param_names.sort.each do |field|
19
20
  %tr
20
21
  %td=field
21
22
  %td=mask_system_configuration(field)
@@ -10,15 +10,26 @@ module CoreSystemConfigurationsController
10
10
  # Edit the system configuration
11
11
  #
12
12
  def edit
13
- load_configuration
13
+ system_configuration
14
+ end
15
+
16
+ # @abstract Cause the system configuration to be synced with the switchboard server
17
+ def sync
18
+ raise 'System Configuration not configured to sync' unless SystemConfiguration.switchboard_configured?
19
+
20
+ Cron::SwitchboardSyncConfiguration.perform_later
21
+ flash[:info] = 'System Configuration Refreshing in the Background'
22
+ redirect_to index_path
23
+ rescue StandardError => error
24
+ log_controller_error error, true
25
+ redirect_to index_path
14
26
  end
15
27
 
16
28
  #
17
29
  # Update and log the system configuration changes
18
30
  #
19
31
  def update
20
- # @system_configuration.update_attributes_and_log! @current_admin_user, system_configuration_params
21
- SystemConfiguration.configuration.update! system_configuration_params
32
+ system_configuration.update! system_configuration_params
22
33
  if SystemConfiguration.switchboard_configured?
23
34
  flash[:info] = 'System Configuration Updated, sync job running in the background'
24
35
  Cron::SwitchboardSyncConfiguration.perform_later
@@ -28,7 +39,7 @@ module CoreSystemConfigurationsController
28
39
  redirect_to index_path
29
40
  rescue StandardError => error
30
41
  log_controller_error error
31
- load_configuration
42
+ system_configuration
32
43
  render :edit
33
44
  end
34
45
 
@@ -44,7 +55,7 @@ module CoreSystemConfigurationsController
44
55
  #
45
56
  # Load the current system configuration
46
57
  #
47
- def load_configuration
58
+ def system_configuration
48
59
  @system_configuration = SystemConfiguration.configuration
49
60
  end
50
61
  end
@@ -15,6 +15,7 @@ module AwsConfiguration
15
15
  field :aws_access_key_id, type: String
16
16
  field :aws_secret_access_key, type: String
17
17
  field :aws_auto_scaling_group_name, type: String
18
+ field :aws_bucket_name, type: String
18
19
  end
19
20
  end
20
21
 
@@ -22,7 +23,7 @@ module AwsConfiguration
22
23
  # Make sure the password doesn't get blanked out on an update
23
24
  #
24
25
  def secure_fields
25
- super + %i[aws_access_secret]
26
+ super + %i[aws_secret_access_key]
26
27
  end
27
28
 
28
29
  #
@@ -38,4 +39,28 @@ module AwsConfiguration
38
39
  def aws_auto_scaling_configured?
39
40
  aws_configured? && aws_auto_scaling_group_name.present?
40
41
  end
42
+
43
+ #
44
+ # AWS client.
45
+ #
46
+ def aws_ec2_client
47
+ return nil unless aws_configured?
48
+
49
+ @aws_ec2_client ||= Aws::EC2::Client.new(region: aws_region,
50
+ credentials: Aws::Credentials.new(aws_access_key_id,
51
+ aws_secret_access_key))
52
+ end
53
+
54
+ #
55
+ # S3 Client
56
+ #
57
+ def aws_s3_client
58
+ return nil unless aws_configured?
59
+
60
+ # We want this to remake itself each time because it is possible that the
61
+ # => user would change the access keys in between actions. Huh?
62
+ @aws_s3_client ||= Aws::S3::Client.new(region: aws_region,
63
+ access_key_id: aws_access_key_id,
64
+ secret_access_key: aws_secret_access_key)
65
+ end
41
66
  end
@@ -17,14 +17,9 @@
17
17
  #
18
18
  module CdnUrl
19
19
  extend ActiveSupport::Concern
20
- #
21
- # Constants
22
- #
23
- STYLE_S3_FILE_PATH = ':class/:attachment/:id/:style.:extension' unless defined? STYLE_S3_FILE_PATH
24
- STYLE_FILE_PATH = 'public/system/:class/:attachment/:id/:style.:extension' unless defined? STYLE_FILE_PATH
25
- STYLE_S3_FILE_URL = ':s3_domain_url' unless defined? STYLE_S3_FILE_URL
26
- STYLE_FILE_URL = ':rails_root/public/system/:class/:attachment/:id/:style.:extension' unless defined? STYLE_FILE_URL
27
20
 
21
+ # @abstract Catch methods started with `cdn_` and respond to those requests if there is a
22
+ # matching method ending in `_url`
28
23
  def method_missing(method, *args)
29
24
  if method.to_s.start_with? 'cdn_'
30
25
  url = if args.blank?
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Google SSO Configuration
5
+ #
6
+ module GoogleSsoConfiguration
7
+ extend ActiveSupport::Concern
8
+
9
+ def self.included(base)
10
+ base.class_eval do
11
+ #
12
+ # Fields
13
+ #
14
+ field :google_client_id, type: String
15
+ field :google_client_secret, type: String
16
+ end
17
+ end
18
+
19
+ #
20
+ # Make sure the password doesn't get blanked out on an update
21
+ #
22
+ def secure_fields
23
+ super + %i[google_client_secret]
24
+ end
25
+
26
+ #
27
+ # Determine if AWS is configured
28
+ #
29
+ def google_sso_configured?
30
+ google_client_id.present? && google_client_secret.present?
31
+ end
32
+ end
@@ -69,7 +69,7 @@ module StandardModel
69
69
  names = field_names(filter_names)
70
70
  names += associations if include_relationships
71
71
  names.delete_if { |name| filter_names.include?(name) }
72
- rescue StandardError => error
72
+ rescue StandardError
73
73
  attribute_names.delete_if { |name| filter_names.include?(name) }
74
74
  end
75
75
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Web47core
4
- VERSION = '3.0.4'
4
+ VERSION = '3.0.5'
5
5
  end
data/lib/web47core.rb CHANGED
@@ -9,6 +9,7 @@ require 'app/models/concerns/cdn_url'
9
9
  require 'app/models/concerns/delayed_job_configuration'
10
10
  require 'app/models/concerns/email_able'
11
11
  require 'app/models/concerns/encrypted_password'
12
+ require 'app/models/concerns/google_sso_configuration'
12
13
  require 'app/models/concerns/search_able'
13
14
  require 'app/models/concerns/role_able'
14
15
  require 'app/models/concerns/time_zone_able'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web47core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.4
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Schroeder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-09 00:00:00.000000000 Z
11
+ date: 2024-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 7.5.2
173
+ version: 8.1.4
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 7.5.2
180
+ version: 8.1.4
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: rails
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -646,6 +646,7 @@ files:
646
646
  - lib/app/models/concerns/delayed_job_configuration.rb
647
647
  - lib/app/models/concerns/email_able.rb
648
648
  - lib/app/models/concerns/encrypted_password.rb
649
+ - lib/app/models/concerns/google_sso_configuration.rb
649
650
  - lib/app/models/concerns/role_able.rb
650
651
  - lib/app/models/concerns/search_able.rb
651
652
  - lib/app/models/concerns/secure_fields.rb